/// <summary> /// Creates a NativeArray containing the selected entities. /// </summary> /// <param name="allocator">The type of memory to allocate.</param> /// <param name="jobhandle">A handle that you can use as a dependency for a Job /// that uses the NativeArray.</param> /// <returns>An array containing all the entities selected by the ComponentGroup.</returns> public NativeArray <Entity> ToEntityArray(Allocator allocator, out JobHandle jobhandle) { #if ENABLE_UNITY_COLLECTIONS_CHECKS var entityType = new ArchetypeChunkEntityType(m_SafetyManager.GetEntityManagerSafetyHandle()); #else var entityType = new ArchetypeChunkEntityType(); #endif return(ComponentChunkIterator.CreateEntityArray(m_GroupData->MatchingArchetypes, allocator, entityType, this, ref m_Filter, out jobhandle, GetDependency())); }