Destroying hierarchy converted from scene GameObjects?

I have some GameObject hierarchies in my scene that are converted using ConvertToEntity and
IConvertGameObjectToEntity. At some point I want to use a command buffer to destroy entire hierarchies. Is there an easy way of doing this?

I thought LinkedEntityGroup would do the trick but apparently that only gets added to converted prefabs?

Should I recurse using Child components to find all child entities?

Thanks, Bas

you can get a linkedentity group like so:

public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
      conversionSystem.DeclareLinkedEntityGroup(gameObject);
     ...
}

you now only have to destroy the root entity

1 Like