Unity Version 2018.4.0
LoadSceneAsync
I have been stuck on this for a day now. So I am turning to the forum for some clues. In other words… “HELP! PLEASE!”
I have a pretty conventional load screen set up:
- A loading-screen - which animates a loading indicator showing progress.
- A main play-screen
The load-screen additively loads a play-screen by calling:
AsyncOperation loadingOp = SceneManager.LoadSceneAsync(_playScreenName, LoadSceneMode.Additive);
The play-screen is then loaded.
The play-screen fairly complex with around 200 individual game objects. (It presents a number of modal interfaces where only one is active at any one time). Much of the scene is contained in prefabs, some with overridden properties.
On being loaded, the Awake methods in the play-screen are automatically called. The most important being a main controller class which lives in the root object of the scene. This root controller maintains references to other parts of the scene. On Awake it does a bit of initial set-up.
To be clear:
This arrangement works, has always worked, (including in standalone builds) and continues to work when run in the editor.
Then I came to make a standalone(unity player) build.
The built version fails.
The play-screen controller awakens, but the references it holds to other monobehaviors in the scene are null.
It turns out they are null because those other scene items are simply not present.
Listing all game objects shows that only one game object (the root controller object) has loaded. Everything else is missing. The references to those missing objects are all null. References to scriptable objects are still there.
So it appears to be an incomplete/partial load. Or possibly a full load followed by an inexplicable purge of all of the non-root game objects.
This partial load behaviour does not seem to be intended Unity functionality. Nothing that I am doing would explain the outcome.
I have read all the posts I can on similar issues. (but none seem identical)
I have tried a great many things.
- Creating a delay between the 0.9 complete load and completing.
- Using an index rather than a name to specify the scene.
- Trying to identify anything that might be problematic in the scene file
- Cleaning Build Caches / Building on another computer
- Switching the .NET versions
- And many, many other things
This is painstaking work because each test cycle involves doing a build, running the standalone and looking at logs.
I have exhausted things to try, and am trying to work-out what has changed since it last worked.
- Unity version has changed (but if this is a new bug, surely more people would be reporting it?)
- The loaded scene file has changed how it is organised. But it is still just a scene file. If it were invalid in some way, surely there should be some fail message?
Any suggestions, things to check for, would be warmly welcome.
Thanks for your.