#Entity subscene does not auto-open

1 messages · Page 1 of 1 (latest)

ripe galleon
#

We have a weird error. Maybe someone has seen it before?

Our entity subscene does not open when we load the game. Thus the scene is not populated with enemies. If we open the scene by selecting the checkbox in the hierarchy it starts without a fuss.

If we make a build the subscene doesn't work either. Does anyone have an idea?

neat chasm
#

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.

ripe galleon
#

How would I check why the baking works when I open the scene by hand but not automatically? I'm without an idea

neat chasm
#

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.

ripe galleon
#

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

neat chasm
ripe galleon
#

I'll check all changes on bakers in my git history

sacred sonnet
# neat chasm The subscene is meant to be closed. A closed subscene is what you get in build. ...

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

ripe galleon
#

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.

sacred sonnet
#

kind of basic but did you try restarting unity editor?

ripe galleon
#

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)

sacred sonnet
#

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

ripe galleon
#

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"

sacred sonnet
#

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

neat chasm
#

What are these entities? Are they not the one you expect?

neat chasm
#

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.

neat chasm
#

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.