Some prefab properties missing but not all when changing scenes

When I change to another scene and later return to the previous one, in the last I have an object with some prefab properties missing but not all. Why this is happening?

The inspector looks the same before and after, but the code says the property is null.



I thought this could be a “race condition” related issue. So I added this whole logic:

Also, I set the Script Execution Order this way:

But you can wait many minutes and nothing is going to change.

Most of the prefab properties are missing, but that’s not the case for “Media Content Prefab”.

Thanks for reaching out!

Remember that the Prefab in a scene is a prefab instance. They wil be destroyed when you switch scenes unless you call DontDestroyOnLoad on the prefab instance object. If you want to save back to the prefab asset to uses these changes across scenes, you have to use the Prefab APIs. Note that this is only possible in Editor mode.

If that does not work, do you think you could report a bug? With a bug report we would have access to your project and be able to troubleshoot it better.

You simply need to follow the steps here: How do I submit a bug report? – Unity.