#Entity subscene does not auto-open
1 messages · Page 1 of 1 (latest)
The subscene is meant to be closed. A closed subscene is what you get in build. Open subscene is only for authoring content - which only works in editor.
If we open the scene by selecting the checkbox in the hierarchy it starts without a fuss.
This is an indicator that your data is incorrectly baked. A closed subscene contains only baked data to feed the ECS world. So you have to double check your baking code.
How would I check why the baking works when I open the scene by hand but not automatically? I'm without an idea
"Open the scene by hand". Let me ask that again, did you enter play mode, then check on this little box?
If yes then you're having a misconception, this box is never meant to be checked in play mode (or at runtime). It has to stay unchecked while you're playing the game.
We only click on this Open button when we want to modify the authoring MonoBehaviour. After we're done with authoring, we close it and leave it unchecked.
How would I check why the baking works
Use Entities Hierarchy, you can see right away if your entities are baked correctly.
I have not used that check mark previously. Only since one of my bakers failed i noticed, that I can trigger it by using the check mark workaround
Then you have to check your baking code. Forcefully open the subscene in play mode is just wrong. It's not meant for that. Because when you build the game, subscenes are baked into binary files which contain only ECS-compatible data.
I'll check all changes on bakers in my git history
I dont think this is true - https://docs.unity3d.com/Packages/com.unity.entities@1.4/manual/editor-authoring-runtime.html It's useful to be able to switch between data modes while in Play mode and Edit mode, so that you can make permanent changes to your application without having to enter or exit Play mode. For example, you could make changes to a level's geometry while in Play mode and save it while remaining in Play mode. but I think in most cases there may be caveats to using this(kind of like hotreloading scripts with monobehaviours), and for many projects(mine included) sometimes things break when the subscenes are open and entering play mode
There are two objects in the subscene with a baker that I have not touched in ages.
None of them triggers when I play the scene with the closes subscene.
I'm very confused. There are no compilation errors once I open the subscene by hand during gameplay. So that's not it. No reference errors from those scripts. No import or bake errors. I did not change versions of unity or dots in between. Domain Reload is on. Hot reload is off.
I cannot see what the entity hierarchy helps here. I can confirm, that the two entities that are supposed to be there have not been baked.
kind of basic but did you try restarting unity editor?
I even wiped the complete folder and started with a blank version from git so unity can do its thing.
In the hierarchy view I can see that the entity is not there. Once I open the subscene it is baked correctly and I can see it.
(All of the other contributors have the same issue)
i would probably start removing things one by one from the subscene and see if it loads correctly after each change, cant really think of a better way to diagnose this
Is it possible, that the SubScene opens correctly but then instantly closes for some reason?
This is when I go through the game. From Title Scene, which loads the moon level. I need GameEntity it is only loaded when I oppen the scene manually. I don't get it 🙁
If you look at the status of the subscenes it changes from "not loaded" to "closed"
well its kind of hard to tell from this as the names are only apparent when the subscene is opened. if gameentity has a unique component on it, you could check for it c=GameEntityComponent and double check it doesnt exist when the subscene is closed
"Not loaded" means subscenes are being loaded and have yet finished.
What are these entities? Are they not the one you expect?
Baker is only triggered if you make some changes on its corresponding authoring component. In a build baking code doesn't run, they only run in editor when or when you build the game.
You can consider a closed subscene is a built binary file. It won't be baked again unless you make any change on the authoring components inside that subscene.
According to what I see in your record clip, your bakers have done their job successfully. They have produced the blue entities for you.
Also, blue entities are prefab entities, they won't show up on the Game view! You have to instantiate actual entities from prefab entity: white ones.
So what happens when you open the subscene while in play mode is that you switch to the live conversion state and it helps you making the changes on authoring components by displaying those entities on screen. Remember that this is only intended for live editing of subscenes in the editor. After that you have to close the subscene to have a similar dataset as in a build.