/// <summary>
        /// Gets an entity's component types.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="allocator">The type of allocation for creating the NativeArray to hold the ComponentType
        /// objects.</param>
        /// <returns>An array of ComponentType containing all the types of components associated with the entity.</returns>
        public NativeArray <ComponentType> GetComponentTypes(Entity entity, Allocator allocator = Allocator.Temp)
        {
            EntityComponentStore->AssertEntitiesExist(&entity, 1);
            var archetype = new EntityArchetype {
                Archetype = EntityComponentStore->GetArchetype(entity)
            };

            return(archetype.GetComponentTypes(allocator));
        }
示例#2
0
        /// <summary>
        /// Gets an entity's component types.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="allocator">The type of allocation for creating the NativeArray to hold the ComponentType
        /// objects.</param>
        /// <returns>An array of ComponentType containing all the types of components associated with the entity.</returns>
        public NativeArray <ComponentType> GetComponentTypes(Entity entity, Allocator allocator = Allocator.Temp)
        {
            var access = GetCheckedEntityDataAccess();
            var ecs    = access->EntityComponentStore;

            ecs->AssertEntitiesExist(&entity, 1);
            var archetype = new EntityArchetype {
                Archetype = ecs->GetArchetype(entity)
            };

            return(archetype.GetComponentTypes(allocator));
        }