How to disable auto-conversion for certain GameObjects in SubScene?

In a SubScene, I’m using some empty GOs for grouping purposes and would like them to not be converted into entities. I tried marking the root GO with StaticOptimizeEntity, but empty GOs down the hierarchy are still getting converted into entities.

If you are using ECS 1.0, have you tried this authroing component

https://docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Entities.BakingOnlyEntity.html

At 2:44

If you are still in 0.51, I think the only way is to make a tag component and a runitme system to destroy entities with that tag.

2 Likes

Ty so much =) I had no idea that existed.

The default BakingOnlyEntityAuthoring Baker and BakingSystem also add BakingOnlyEntity to the children. So I just use a new authoring comp to leave the children alone. (Works in my case because of the Unity.Transform.Static usage; otherwise children will be stripped regardless)

public class SingleBakingOnlyEntityAuthoring : MonoBehaviour {
}

class SingleBakingOnlyEntityAuthoringBaker : Baker<SingleBakingOnlyEntityAuthoring> {
    public override void Bake(SingleBakingOnlyEntityAuthoring authoring) {
        AddComponent<BakingOnlyEntity>();
    }
}
1 Like