internal EntityManager(World world) { TypeManager.Initialize(); StructuralChange.Initialize(); EntityCommandBuffer.Initialize(); m_World = world; m_DependencyManager = (ComponentDependencyManager *)UnsafeUtility.Malloc(sizeof(ComponentDependencyManager), 64, Allocator.Persistent); m_DependencyManager->OnCreate(); m_EntityComponentStore = Entities.EntityComponentStore.Create(world.SequenceNumber << 32); m_EntityQueryManager = Unity.Entities.EntityQueryManager.Create(m_DependencyManager); m_ManagedComponentStore = new ManagedComponentStore(); m_EntityDataAccess = new EntityDataAccess(this, true); m_ExclusiveEntityTransaction = new ExclusiveEntityTransaction(this); m_UniversalQuery = CreateEntityQuery( new EntityQueryDesc { Options = EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabled } ); m_UniversalQueryWithChunks = CreateEntityQuery( new EntityQueryDesc { All = new[] { ComponentType.ReadWrite <ChunkHeader>() }, Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab }, new EntityQueryDesc { Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab } ); #if ENABLE_UNITY_COLLECTIONS_CHECKS m_UniversalQuery._DisallowDisposing = "EntityManager.UniversalQuery may not be disposed"; m_UniversalQueryWithChunks._DisallowDisposing = "EntityManager.UniversalQuery may not be disposed"; #endif }
internal EntityManager(World world) { TypeManager.Initialize(); StructuralChange.Initialize(); m_World = world; m_ComponentJobSafetyManager = (ComponentJobSafetyManager *)UnsafeUtility.Malloc(sizeof(ComponentJobSafetyManager), 64, Allocator.Persistent); m_ComponentJobSafetyManager->OnCreate(); m_EntityComponentStore = Entities.EntityComponentStore.Create(world.SequenceNumber << 32); m_ManagedComponentStore = new ManagedComponentStore(); m_EntityQueryManager = new EntityQueryManager(m_ComponentJobSafetyManager); m_EntityDataAccess = new EntityDataAccess(this, true); m_ExclusiveEntityTransaction = new ExclusiveEntityTransaction(this); m_UniversalQuery = CreateEntityQuery( new EntityQueryDesc { Options = EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabled } ); m_UniversalQueryWithChunks = CreateEntityQuery( new EntityQueryDesc { All = new[] { ComponentType.ReadWrite <ChunkHeader>() }, Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab }, new EntityQueryDesc { Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab } ); }
internal void Initialize(World world) { TypeManager.Initialize(); StructuralChange.Initialize(); EntityCommandBuffer.Initialize(); #if ENABLE_UNITY_COLLECTIONS_CHECKS m_Safety = AtomicSafetyHandle.Create(); #if UNITY_2020_1_OR_NEWER if (s_staticSafetyId.Data == 0) { CreateStaticSafetyId(); } AtomicSafetyHandle.SetStaticSafetyId(ref m_Safety, s_staticSafetyId.Data); #endif m_JobMode = false; #endif m_EntityDataAccess = (EntityDataAccess *)UnsafeUtility.Malloc(sizeof(EntityDataAccess), 16, Allocator.Persistent); UnsafeUtility.MemClear(m_EntityDataAccess, sizeof(EntityDataAccess)); EntityDataAccess.Initialize(m_EntityDataAccess, world); }