using 2020.3.4f1 - still an issue. To be honest i have only found this thread today and I have just been managing with the bug but its now happening more frequently so i searched it. Originally, it was difficult to find the cause of this problem. i spent ages running through all aspects of my code… now I have a step to check… see if any prefabs have lost their references. Fortunately, all my prefabs are in a _prefabs folder so I can simply right click and reimport the whole folder which doesn’t take too long since they are just prefabs and variants and it solves the missing references. (I would prefer not to have to worry about this tho…)
It happens in-between updating scripts and compilation. Not every time and I cannot reproduce reliably. I can usually tell when its happened when I get a bunch of unexpected null reference exceptions and I have actually put custom warnings into my scripts to let me know if references have been lost… When it happens I reimport the prefabs folder and run again and its generally ok… Its not a perfect solution, but we work with what we’ve got, right?
If any one has a solution to this (because its been happening on my main project since being in 2020.3…) that would be great. I thought maybe it might be an editor setting? one of the compile after playing etc Any way just thought I would chip into the conversation ![]()
also - I am a plasticSCM user… just saying in case that may have something to do with it.
Been having the same problem for a while now.
Often I will make a seemingly innocuous code change and then suddenly a prefab reference in entirely unrelated part of the game loses it references. Eg I had 4 Prefab Wing tip trail Game Objects referencing a special effect prefab and 1 of them suddenly lost its reference while rest were fine. This after adding two lines of code that were nothing to do with these game objects. The code changes also compiled fine.
It’s as if Unity constantly re-establishes the references at each save/load but sometimes encounters issues and instead of informing the user, simply doesn’t set it and moves on. Immensely frustrating.
I’m using Unity 2020.2.2f1. Yes I know I should upgrade to .3 but every time I upgrade things break and I lose several days trying to fix it (another painful feature of Unity). That’s time I don’t have right now.
This happened for the first time when I upgraded to Unity 2019.4.28f1
Prefabs dont have references when instantiated or when selected from the editor, but if I open it I see all the references in it.
@Hazneliel same here. Same version upgrade caused a couple of prefabs loosing it. Reimport helped
Exact same as @Hazneliel and @ . Just upgraded to 2019.4.28f1 from 2019.4.16f1 and for the first time ever I have this problem. I see in the inspector that my spawned player sets a reference in a script in my scene (set it to public to check), but the script gives the no reference error when I want to call a method on the script that has been referenced. This has worked forever until now. I’ll try reimporting.
Same here @volblob73 , just tried both 2019.4.15 and 2019.4.33
I can confirm this happens in 2022.1A15 and A16. Just had this issue and had to reimport.
EDIT: I fixed this by reimporting all, then when variables were correct, I used a script to detect all prefabs and marked them dirty.
Then saved and quit editor.
Upon restart it didnt happen again.
NVM…it just came back a while later. Can we pls fix this? Thanks
Another update: Deleting the Library folder fixed the issue.
We are experiencing this on our project in 2021.2.3, are there any updates to it?
@jjejj87 @Tony1974 @Emery-Monzerol Are you guys using Plastic? We are trying to narrow it down and it seems like Plastic could possibly be the issue, as we are using it the same as @gazbushell and I have found this thread on Plastic support Plastic SCM breaks prefabs, un-assigns all references. - Unity 3D - Plastic SCM Community
Oh my god I was so scared for some 5 minutes until I’ve found this thread and realized I can fix it by re-importing. I’m using Unity 2020.3.5f1 and the bug still exists here. Although first time for me.
Without being able to reproduce, to give some details (in case it helps pinpointing the issue):
I had nested prefabs in the scene, a parent prefab that included other prefabs. I went inside one of the child prefabs of a child prefab and edited something harmless, a collider’s radius, I’d done similar edits in that child prefab many times before. What I don’t remember if I saved the change in the child prefab and then hit play without returning to the top-level scene hierarchy (I do that mistake sometimes) or did I exit the prefab view before entering Play Mode.
But as soon as in Play Mode, it started to throw errors and then I noticed that all the child prefabs in the main parent prefab that contained the edited grandchild prefab suddenly showed “Missing Prefab” in the hierarchy (and it wasn’t even brown color like when you delete a prefab).
I tried reloading the scene, restarting Unity but the Missing Prefab issue remained in every affected scene. The weirdest thing was that the Prefab was only reported ‘Missing’ when I was in top-level scene hierarchy and it couldn’t access the child prefabs from that level of hierarchy (or in Play Mode). But when I opened the parent Prefab for editing, it showed all the child prefabs inside fine, they were all linked correctly in that view, the same ones that were reported missing in the top hierarchy.
I almost decided to revert to a previous day’s backup (would’ve been a day’s work lost) but luckily I’ve found this thread and a simple re-importing of the parent prefab fixed everything.
Steps to reproduce issue (Unity 2018.3.0f2):
- Prefab object with child object with SpriteRenderer, empty Animator, and Script with public variables. Disable prefab.
- Prefab variant of prefab
- Prefab variant of variant. So, now Item1 → Item2 → Item3
- Customize variants
- Copy animation controller and animation files from something similar
- Edit script of prefab, adding public animator variable, and boolean.
- Reorder some existing variables (this probably broke everything) in script. Move some variable lines of code higher up.
- Open prefab. Enable prefab.
- Set anim controller.
- Edit animitor, changing animation clip to be the copied one.
- Make new animation with new sprites.
- Delete old property and frames from animation
- Disable prefab, and exit prefab mode.
- Play game
Step 7 (or both step 7 and 8) is probably what caused the variants to all break and revert to their original state of prefab.
Sometimes the bug is different, in that it will change some variable references to prefabs (on my Pool object/script) from referencing the prefab in my assets, changing to referencing a copy of that prefab in my scene instead. Very strange and unexpected. It’s happening more often now, and so I’ve stopped dragging prefabs into my scene for testing, or have limited it greatly by deleting them from my scene soon after im done. In my scene, i have these prefabs enabled when testing, while they are disabled in their prefab configuration.
I don’t plan on updating Unity. The updates have always contained things I don’t want, and didn’t ask for. And according to my research (the comments above), this bug is still happening in Unity 2021. I would rather install just a patch that Unity could release for this issue.
I may try to downgrade Unity to before prefabs, or stop I’ll using prefab variants. If I still experiencing issues, then I may stop making prefabs altogether, and just make everything as objects in my scene, in disable parent pool-like object/enclosure and reference from that.
Our issue might be slightly different, we have seen it two or three times in the last few weeks in 2020.3.27. Upon opening the editor after a perforce sync, some team members see a warning that there is a missing prefab with guid xxx. Upon opening the prefab that contains the missing asset, we see a little red prefab icon. I have searched the whole project, and even rolled back month of work and searched again, but as far as I can tell we have never had an asset with the guid reported in the error.
Anyone in this thread: Please report a bug with a project that has the setup and describe the reproduction steps. That will greatly help us investigate what the issue is and get it fixed.
If you like, I’m sure we could set you up with a perforce seat for our project, you could sync, and the next time we see the problem you could sync again and see the missing resource notification. Would that be useful?
Yes indeed, that would be helpful.
You can DM me when it happens next time with the info needed. Thank you.
I have the same bug.
Has anyone reported this yet?
It looks like @arkore has a way of reproducing it
It looks like this might be the same bug Importer(MonoImporter) generated inconsistent result for asset - Unity Engine - Unity Discussions