#SubScene missing in build
1 messages · Page 1 of 1 (latest)
Is your subscene in a scene, and is this scene (not the subscene) included in the scene list in the build window?
in other words: for subscene to get baked it must be part of included in a build scene.
Yes the subscene is in the scene that I build. I tried also building both scenes don't know if this helps or not
share details how exactly it is not available
Yes I can share tomorrow some pictures and the exact log. Sorry this was a late night idea to post this question on the Discord
and what platform you're building for
From Windows to windows
yep, that should work. i do personally recommend updating to 1.0.8, but i'm not specifically aware of an issue fixed about subscenes not appearing in builds (except for webgl)
but yeah, wait for tomorrow when you can paste the exact message
This is the exception:
NullReferenceException: Object reference not set to an instance of an object
at Unity.Entities.EntityQueryImpl.GetSingleton[T] () [0x00053] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.65\Unity.Entities\Iterators\EntityQuery.cs:1419
at Unity.Entities.EntityQuery.GetSingleton[T] () [0x00000] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.65\Unity.Entities\Iterators\EntityQuery.cs:2693
at Spawner.Start () [0x0004e] in C:\Users\denni\Unity\2D\FactoryMain\Factory\Assets\Scripts\Buildings\Spawner.cs:27
(Filename: ./Library/PackageCache/com.unity.entities@1.0.0-pre.65/Unity.Entities/Iterators/EntityQuery.cs Line: 1419)
NullReferenceException: Object reference not set to an instance of an object
at Unity.Collections.LowLevel.Unsafe.UnsafeUtility.WriteArrayElement[T] (System.Void* destination, System.Int32 index, T value) [0x00001] in C:\build\output\unity\unity\Runtime\Export\Unsafe\UnsafeUtilityPatched.cs:60
at Unity.Entities.DynamicBuffer1[T].set_Item (System.Int32 index, T value) [0x00001] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.65\Unity.Entities\Iterators\DynamicBuffer.cs:193 at Unity.Entities.DynamicBuffer1[T].Add (T elem) [0x00012] in .\Library\PackageCache\com.unity.entities@1.0.0-pre.65\Unity.Entities\Iterators\DynamicBuffer.cs:347
at Spawner.SpawnTrashcan (Unity.Mathematics.int2 pos) [0x0005a] in C:\Users\denni\Unity\2D\FactoryMain\Factory\Assets\Scripts\Buildings\Spawner.cs:187
at TestGenerator.SpawnIronBlueprint (System.Int32 x, System.Int32 y) [0x000b5] in C:\Users\denni\Unity\2D\FactoryMain\Factory\Assets\Scripts\TestGenerator.cs:42
at TestGenerator.Start () [0x00021] in C:\Users\denni\Unity\2D\FactoryMain\Factory\Assets\Scripts\TestGenerator.cs:16
And this is my build config:
I suspect you don't have a require for update dependency -edit-seems like you're trying to do this from a monobehaviour start which I doubt will ever work in a build
And that you've done all your testing in editor with your subscene open
Subscenes load async
The world will tick multiple frames before the Entities load from it
If you have an open subscene in editor its entities always exist but this is not how it works in builds
Oh well this is a good guess. I have required for update in my systems but not in my MonoBehaviour. Can you do this there as well?
No. But your entities won't exist in start
Ok then I will try a workaround for this. Thank you very much
(I have a personal rule never to access entity world from game objects because life cycle management is way too much of a problem)
(I only drive gameobject behaviour from systems, but never the other way)
If you do need to do it this way you'll have to query until entity exists or something
I spawn some entities from pressing a button. What would the best approach for this?
I do this all in systems
How do you connect the button to the system?
Well I use uitoolkit which requires no gameobjects
But there are many ways you can link your ugui gameobjects
As simple as some statics
As complex as messaging systems
Ok thank you. Then I will have a look at this uitoolkit