#if UNITY_ECS using Svelto.ECS.Hybrid; using UnityEngine; namespace Svelto.ECS.Extensions.Unity { public static class EntityDescriptorHolderHelper { public static EntityComponentInitializer CreateEntity(this Transform contextHolder, EGID ID, IEntityFactory factory, out T holder) where T : MonoBehaviour, IEntityDescriptorHolder { holder = contextHolder.GetComponentInChildren(true); var implementors = holder.GetComponents(); return factory.BuildEntity(ID, holder.GetDescriptor(), implementors); } public static EntityComponentInitializer Create(this Transform contextHolder, EGID ID, IEntityFactory factory) where T : MonoBehaviour, IEntityDescriptorHolder { var holder = contextHolder.GetComponentInChildren(true); var implementors = holder.GetComponents(); return factory.BuildEntity(ID, holder.GetDescriptor(), implementors); } } } #endif