Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NudityStation - Prefab Variants Cause Missing References And Lose Connection To Parent #2551

Closed
chairbender opened this issue Jan 6, 2020 · 14 comments
Labels
Type: Bug Already implemented, but isn't fuctioning as expected.
Projects

Comments

@chairbender
Copy link
Contributor

chairbender commented Jan 6, 2020

Temporary Workaround

There are 2 ways to workaround this in the meantime. DO NOT DO A REIMPORT ALL, SAVE YOURSELF THE TROUBLE.

  1. If your prefabs have stopped adjusting their settings from the parent prefab (this can happen with clothes, they lose their item attributes settings), right click the Prefabs folder and choose "Reimport" (NOT REIMPORT ALL).
  2. If you have assets which have "Missing" for a field that should reference a prefab, git reset --hard should fix it. This restores the missing asset reference. I don't think you need to close Unity.

Both of the situations seem to happen after doing a standalone build. So you might want to check after you do a build to see if clothing items (such as MiningHardsuit.prefab) have correctly filled out ItemAttributes and references aren't broken (such as SmallBoxPopulator's references to breath mask)

Description

This only seems to affect prefab variants and references to prefab variants. It usually shows up in the game where you spawn the player and they are missing several of their starting items.

This usually only happens after merging or switching branches or doing a standalone build.

You can see this in action in 2 ways (sometimes only one of them happens).

  1. Go open an asset which has prefab references, such as SmallBoxPopulator. Note that one of the fields is "Missing".
  2. Go open MiningHardsuit.prefab. Note that ItemAttributes fields are all blank.
@chairbender chairbender added the Type: Bug Already implemented, but isn't fuctioning as expected. label Jan 6, 2020
@chairbender chairbender changed the title Missing Asset References Keep Happening Missing Prefab Asset References Keep Happening Jan 6, 2020
@JesterX666
Copy link
Contributor

I'm adding those lines to the PopulateItemStorage function:

			// General protection against missing items
			if (Contents[i] == null)
			{
				Logger.LogError($"Item is missing at position {i} of {toPopulate.name}");
				continue; // Will skip the missing item
			}

That won't solve the issue but will make finding the missing asset easier and won't cause a bug when starting the round.

@chairbender
Copy link
Contributor Author

Here's some screenshots / snippets of what it looks like:
Smallbox fails to spawn with breath mask in player inventory. Here's what the inventory populator looks like.
image
Here's the yml for this asset

  Contents:
  - {fileID: 6404652678407139925, guid: dce8e376d2eca40eabe3f055b41a021c, type: 3}
  - {fileID: 1277678737481138, guid: f99902d04c3b1fe47b0e4e4ec36b7971, type: 3}

Here's the yml for BreathMask.prefab.meta:

fileFormatVersion: 2
guid: dce8e376d2eca40eabe3f055b41a021c
PrefabImporter:
  externalObjects: {}
  userData: 
  assetBundleName: 
  assetBundleVariant: 

SEE? The asset ID is correct! The populator is referencing the correct GUID for breathmask. But it's being treated as if it's missing.

@JesterX666
Copy link
Contributor

A mystery to be solved : why did we both get the same issue, at the same time, with the same asset? (Breathmask too!)

@chairbender
Copy link
Contributor Author

@chairbender
Copy link
Contributor Author

also here's the YML for BreathMask.prefab. I'm thinking maybe it's the fileID reference that's wrong? I'm not sure what in here corresponds to fileID, maybe that --- !u!1001 &3573969270142637268 thing? That doesn't match the fileID in SmallBoxPopulator:

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &3573969270142637268
PrefabInstance:
  m_ObjectHideFlags: 0
  serializedVersion: 2
  m_Modification:
    m_TransformParent: {fileID: 0}
    m_Modifications:
    - target: {fileID: 3532393564309681412, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: clothData
      value: 
      objectReference: {fileID: 11400000, guid: 7396b9308d8284df280e4b2036e0a90d,
        type: 2}
    - target: {fileID: 7557917173024864117, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: Resistances.Flammable
      value: 1
      objectReference: {fileID: 0}
    - target: {fileID: 7560587375320734517, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_AssetId
      value: 
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalPosition.x
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalPosition.y
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalPosition.z
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalRotation.x
      value: -0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalRotation.y
      value: -0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalRotation.z
      value: -0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalRotation.w
      value: 1
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_RootOrder
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalEulerAnglesHint.x
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalEulerAnglesHint.y
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 7596215297033493493, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_LocalEulerAnglesHint.z
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 7600017545650087553, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_Name
      value: BreathMask
      objectReference: {fileID: 0}
    - target: {fileID: 7600017545650087553, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_TagString
      value: Clothing
      objectReference: {fileID: 0}
    - target: {fileID: 7748823779942372829, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: m_Sprite
      value: 
      objectReference: {fileID: 21300000, guid: 0a269903f7997d34497305b2b54fe2f0,
        type: 3}
    - target: {fileID: 8040391005062056419, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: initialName
      value: breath mask
      objectReference: {fileID: 0}
    - target: {fileID: 8040391005062056419, guid: 05a135eab68164d34bb02b82fff3cde0,
        type: 3}
      propertyPath: initialDescription
      value: A close-fitting mask that can be connected to an air supply.
      objectReference: {fileID: 0}
    m_RemovedComponents: []
  m_SourcePrefab: {fileID: 100100000, guid: 05a135eab68164d34bb02b82fff3cde0, type: 3}

@chairbender
Copy link
Contributor Author

so I just fixed this by closing unity, git reset --hard, then switching to develop, then reopening unity. The file contents are still the same but it didn't require a reimport.

@chairbender
Copy link
Contributor Author

And then it broke after I made a standalone build of the game.

@chairbender
Copy link
Contributor Author

So I closed unity, did a git reset --hard, reopened, then when I open the StandardSmallBoxPopulator asset in editor the reference is no longer shown as missing. I checked and saw that the file contents I pasted above were still all the same. Then I created a standalone build. After the build was done, I got the "importing..." progress bar, all of my prefab assets showed as modified by git, and this issue reappeared. It was only the prefabs that were showing as modified. This particular asset, BreathMask.prefab, only differs by line separators according to git.

@chairbender
Copy link
Contributor Author

And the key difference I noticed between the assets that this happens to and the ones it doesn't happen to is, the ones it happens to are prefab variants. The ones it doesn't happen to are just normal prefabs.

@chairbender
Copy link
Contributor Author

chairbender commented Jan 6, 2020

Temporary workaround. Building standalone game causes the issue. Git reset hard fixes it. So, after every standalone build you should ensure you've committed your changes and run git reset --hard. This restores the missing asset reference. I don't think you need to close Unity. It doesn't seem like Editor build causes the issue, only standalone.

@chairbender chairbender changed the title Missing Prefab Asset References Keep Happening Prefab Variants Cause Missing References And Lose Connection To Parent Jan 12, 2020
@chairbender chairbender changed the title Prefab Variants Cause Missing References And Lose Connection To Parent NudityStation - Prefab Variants Cause Missing References And Lose Connection To Parent Jan 12, 2020
@chairbender
Copy link
Contributor Author

Updated with new findings and temporary workaround.

@chairbender
Copy link
Contributor Author

created a thread for this: https://forum.unity.com/threads/prefab-variant-missing-references-and-losing-parent-settings.807840/

Working on a reproduction to submit a bug report.

@chairbender
Copy link
Contributor Author

foma heard from a Unity dev that this is supposedly fixed in 2020, but it's going to be awhile before we actually switch to that

@krille90 krille90 added this to Low priority in Bugs Feb 4, 2020
@Aranclanos
Copy link
Member

the project updated its unity version and nuditystation doesnt seem to be happening anymore, or prefab variants losing the values of their parent

Bugs automation moved this from Low priority to Closed Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Already implemented, but isn't fuctioning as expected.
Projects
Bugs
Closed
Development

No branches or pull requests

3 participants