gustavopsantos/Reflex

SceneScope attempts to inject before scene is loaded

lyonbeckers opened this issue · 1 comments

Describe the bug
Works in editor, but in builds, we get a InvalidOperationException from Reflex.Core.SceneScope.Awake. This was not happening before, so as far as I can tell reproduction is going to be difficult/non-deterministic. We may need some clarification from Unity, but my best guess is that when DefaultExecutionOrder is int.MinValue, it maaaay be the same mechanism by which Unity actually flags the scene as loaded?

InvalidOperationException: Accessing game object transform hiearchy before loading of scene has completed. This is not allowed.
  at UnityEngine.GameObject.GetComponentsInChildren[T] (System.Boolean includeInactive, System.Collections.Generic.List`1[T] results) [0x00011] in C:\buildslave\unity\build\Runtime\Export\Scripting\GameObject.bindings.cs:137 

To Reproduce
Steps to reproduce the behavior:

  1. Load a scene with a scene scope object
  2. Observe (potentially) an InvalidOperationException

Expected behavior
No InvalidOperationException, scene injection works as intended.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 11
  • Version 8.1.0
  • Unity 2021.3.7f1

Upon further testing, no amount of adjusting the DefaultMinOrder seemed to matter. Noticed that there was a prefab issue with the scene, fixed it, and it seems to have been what was causing the issue. User error