Entities 1.0.8
The problem:
When starting the game (.exe which was built) Unity will crash, when some System enters OnUpdate and tries to access GetSingletonRW<SomeComponent>() and SomeComponent has not been created yet.
I do know that we can use RequireForUpdate for circumvent this, but Rider does not always recommend this and when making changes one can easily forget this.
And the biggest problem is that this crash only occurs in the build game and not in Play Mode. How is that possible, does the System execution order differ between Build and Editor?
My request:
- Add a StackTrace when the game crashes because of that (I didn't get any message regarding what kind of Exception or where it was thrown, when looking at the Editor Console with a Development Build + Autoconnect Profiler)
- Or automatically implement RequireForUpdate when some Component is being Get in OnUpdate
It took me hours to find the root of this problem and only with the help of using Debug.LogError in every OnFunction in all of my Systems (which took ages) + waiting for Build.
Is there maybe a better way for finding such problems? I would be more than happy if that was the case.
Note:
The Error Message + StackTrace is shown in the screenshot only because I've used a try catch to showcase the issue (normally this would not be shown)