Find the entity from a subscene gameobject

Hey,

does anyone know how to find the entity from a converted gameobject in a subscene?

My case right now is that I want to build proper hybrid gameobjects. MB as presentation, without spawners and instantiations. (As many have problems with the conversion approach, I think this could also help others, especially level designers)

A gameobject in a subscene is already converted to an entity via EditorWorld systems.
A gameobject in a scene is NOT automatically converted and needs a ConvertToEntity MB comp.

If you put a MonoBehaviour with IConvertGameObjectToEntity and output the converted entity in the Convert method, using conversionSystem.GetPrimaryEntity, it outputs the correct one at runtime when the GO is in a scene. In a subscene it outputs Entity 0:1 (for me, index might differ for others)

From what I could test the entity Index:Version in editor isn’t different to the one in runtime.

How can we get the correct entity at runtime (or editor)?

What exactly needs a reference to an entity here? Is it the converted monobehaviour component (assuming it’s setup to not be destroyed during conversion)? If that’s the case you can store a reference to the entity in the monobehaviour component during conversation (as long as it’s implementing IConvertGameObjectToEntity).