public void SetSiblingIndex(int index) { Index = new SiblingIndex { Index = index }; if (m_EntityManager.HasComponent <SiblingIndex>(Entity)) { m_EntityManager.SetComponentData(Entity, Index); } else { m_EntityManager.AddComponentData(Entity, Index); } }
public EntityNode(ISceneGraph graph, Session session, Entity entity) : base(graph) { m_Session = session; m_WorldManager = m_Session.GetManager <IWorldManager>(); m_EntityManager = m_WorldManager.EntityManager; m_ComponentCache = m_Session.GetManager <UnityComponentCacheManager>(); Entity = entity; Guid = m_WorldManager.GetEntityGuid(entity); if (m_EntityManager.HasComponent <SiblingIndex>(Entity)) { Index = m_EntityManager.GetComponentData <SiblingIndex>(Entity); } else { Index = new SiblingIndex { Index = int.MaxValue }; m_EntityManager.AddComponentData(Entity, Index); } }