Needed objects destroyed after deserialization
Hello everyone,
I am working on a game that has about 100 assets that need to be quickly available for instantiation at runtime, so I am using the Resources folder to load all of the assets in at the start, and then create instances from there.
The issue I have now encountered is that my objects get destroyed after deserialization is complete (After Awake and Start functions run), before the game resumes, but it only happens when the build (standalone win64) is exported, in play mode the whole serialization/ deserialization works flawlessly. I have spent a lot of time debugging to see exactly where the objects are being destroyed, and it looks to me like it has something to do with Unity's native Serialized Asset GC- Right before all of the objects are destroyed, there is a message in the log saying: "Unloading 4 unused Serialized files, (Serialized files now loaded: 0). This message only appears in the build.
I've been stuck on this issue for a while, and I don't have any code that could mimic this sort of behaviour- all object destruction is handled by a single closely monitored script to ensure the state remains up to date.
Any help would be hugely appreciated. If I can provide any additional information that would help, please let me know. I have logs that compare identical runs in the player and build as well.
Your answer
Follow this Question
Related Questions
Is it possable to exclude some objects from loading in the editor before building? 0 Answers
Project folder not loading 1 Answer
Warning:Trying to move asset to location it came from...[Please Help] 0 Answers
What version started allowing Editor and Resources folders to be anywhere under Assets folder? 0 Answers
What use instead of Resources folder? 3 Answers