SceneManager.LoadSceneAsync not activating any objects

I have a problem with SceneManager.LoadSceneAsync in Unity 5.6.0 WebGL build only.
Works fine in the Editor and desktop and used to work fine in Unity 5.3 WebGL and Webplayer builds.

When using it in some projects and not others it doesn’t activate any of the objects from the loaded scene.

It also works fine in Unity 5.6.1, 5.6.2, 5.6.3 and 2017.1 but not in 5.6.0

Unfortunately 5.6.1 and above have other bugs that prevent me from using them to solve the problem.

I can’t find a patch for 5.6.0 that fixes this so does anyone know of any work around to get a loaded scene to activate the objects loaded from it?

This is the code snippet where I’m using it

AsyncOperation async = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
yield return async;
async.allowSceneActivation = true;

It seems to completely load ok, I can put a debug statement after the yield and that shows up fine. But any debugs in any Start functions of any loaded object fail to appear and neither does any of the geometry in the loaded objects

I’ve seen a few similar threads but nothing in any of those appear to work in my instance and all seem to relate to older versions

Which other bugs?

I’ve yet to pin down the cause and make you a repro case as I’ve been tied up with this issue. But something has changed with something to do with cameras or render textures or replacement shaders. So in 5.6.0 I have a function that renders the scene using a replacement shader from multiple angles into a bunch of render textures and I then count the number of pixels in the result to find the angle where the object is largest, in 5.6.1 and above that no longer works the same. It’s very involved to pin down the issue so I reverted to 5.6.0 where it still works - has been since 3.5 - only to get hit by this loading problem. Stuck between a rock and a hard place…

Might be related to this issue - Transform issues in WebGL Builds only with Unity 2017 - Unity Engine - Unity Discussions
My first thought was just that the camera transform I was reading as the result was out by 180 degrees. However rotating it back by 180 didn’t entirely fix the issue so I gave up working around it

With regard to the loading issue, I have 12 projects all with identical code but different scene objects, 9 of them work fine and 3 exhibit the issue described above.

I’m currently trying 5.5.4 and 5.6.0p4 in the vain hope that everything works in one of those builds.

Those builds were a no go so I’m going to try and track down the error and either modify my code or report a repro bug case

Bug report - Case 948147
Seems to be something to do with changes to when OnPostRender() is called.

If this was a deliberate change I wonder
A. Why was it done in a minor point release, seems a big change to just slip in unannounced
B. Why was it not documented somewhere, or maybe it is and it’s very hard to find

Going to try a work around using coroutines to wait for the end of the frame which seems to work in my test case.

It’s more likely this is a regression introduced by a bug fix…

I hope so and that there is a quick patch, though I think I have a work around the way it used to work was preferable

And now I’ve hit this bug

rapidly loosing faith…

That does not seem to be a webgl-specific issue but, anyway, are you on the latest patch?

EDIT: also, what version of Unity is that? I have been told the compilation pipeline has been rewritten in 2017.1 and we haven’t been able to reproduce it there.

That was 2017.1
I actually want to use 3.6.3 so trying that this morning.

What I’ve found in 2017.1 is thiis

  1. I made a load of changes to about 6 files
  2. It compiled for ages, like 30 minutes
  3. Eventually it seemed to stop so I pressed the play button
  4. It then froze for ever so I killed the process
  5. I reopened the project and nothing seemed to be compiling, so I pressed play, it froze again
  6. I killed it again and went home.

Today I’m trying with 3.6.3

I managed to get it to compile and run in 5.6.3 but my work around does not fix the issue

Going back to 2017.1 changing platforms, seemed to force it to recompile.
However I then made one change to a script and it’s gone back to being frozen again… :frowning:

Ok so it does compile eventually but it takes an absolute age each time I make a tiny change

Heard back from support on the rendering issue, the problem comes down to the Allow HDR toggle on the camera. Turn that off and it works.

1 Like