Hello, wondering if someone could help me out with a question. I have a Util class for creating entity archetypes from enum. This util class is used in a public class DataAuthoring : MonoBehaviour, IConvertGameObjectToEntity conversion method to generate an EntityArchetype and to then add to an additional entity. Is there a way to get to the destWorld to CreateArchetype without passing dstManager?
I assume this will not work.
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager; // Wrong World !!!
public static EntityArchetype ToEntityArchetype(MyType type)
{
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager; // Wrong World !!!
return type switch
{
MyType.A => entityManager.CreateArchetype(typeof(AComponent)),
MyType.B => entityManager.CreateArchetype(typeof(BComponent)),
MyType.C => entityManager.CreateArchetype(typeof(CComponent),typeof(AComponent)),
_=> throw new ArgumentException(nameof(MyType.type), $"Not expected value {type}")
};
}
thanks in advance