Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Prefab references disappear on instantiate

Discussion in 'Prefabs' started by mccaber, Sep 15, 2018.

  1. mccaber

    mccaber

    Joined:
    Sep 18, 2013
    Posts:
    19
    When I instantiate prefabs that have a script with a reference to another prefab the reference disappears. The references had worked in previous versions. I am using Resources.Load if that matters (something to fix). Any idea how I can get the references to load?
     
  2. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,594
    We're looking into this issue. In the mean time, could you let us know if selecting the Prefab Asset and selecting "Reimport" fixes the issue?

    Note: Choosing "Reimport All" does not work (also something we're investigating).
     
  3. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    227
    I had experienced something like this. The prefab had references to the other prefabs when I were in prefab editing mode and all that, but lost it when it appeared in the scene. So to fix it, I did it "the old way" by dragging out the prefab into the scene, (and there I noticed the reference was lost) set the prefab as a reference, applied my changes and removed it from the scene. I hope this helps you!
     
  4. mccaber

    mccaber

    Joined:
    Sep 18, 2013
    Posts:
    19
    I ended up with pretty much the same solution. It seems that after upgrading the project the references were maintained in the editor but whatever manifest tells unity what to package for a build forgets that there is a reference until you rebuild/relink it. I manually reset the references so I can't say if the re-import option works but I'm betting it would since reassigning would require the asset be rebuilt again? Sorry I can't give more info. I like the new prefab set up so far though.
     
  5. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    48
    Wow, had the same issue in Unity 2018.3.6f1 and I thought the Prefabs from Fungus (narrative plugin) were all broken. Duplicating the prefab or Reimporting them fixed the issue indeed. But it doesn't change any file, so it's not a bug that you can fix on the plugin developer's side by making a commit. I guess it was coming from my local cache?

    Is it possible that the binary to text conversion cause issues when using binary prefabs from the asset store and Forcing them into Text? In this case, the developer could still fix the issue on his own side by resaving the assets as Text after upgrading to Unity 2018.3 (and possibly again as Binary, if that forces to match some new format and changes the final result?)
     
  6. megagon

    megagon

    Joined:
    Jan 7, 2016
    Posts:
    2
    Seem's like we're having the same issue in 2018.4.0f1 on some machines. Any idea what causes it or how to get rid of it?
     
  7. Alebra88

    Alebra88

    Joined:
    Jul 12, 2019
    Posts:
    5
    I have the same problem.

    The only thing I noticed is that if I drag and drop a prefab1 istance into a prefab2 istance, in the inspector the field name is marked with bold characters.

    If I drag and drop prefab1 into prefab2, in the inspector the field name is written with normal characters ( and the references are lost ).