internal EntityArchetype CreateArchetype(ComponentType *types, int count) { ComponentTypeInArchetype *typesInArchetype = stackalloc ComponentTypeInArchetype[count + 1]; var cachedComponentCount = FillSortedArchetypeArray(typesInArchetype, types, count); // Lookup existing archetype (cheap) EntityArchetype entityArchetype; #if ENABLE_UNITY_COLLECTIONS_CHECKS entityArchetype._DebugComponentStore = EntityComponentStore; #endif entityArchetype.Archetype = EntityComponentStore->GetExistingArchetype(typesInArchetype, cachedComponentCount); if (entityArchetype.Archetype != null) { return(entityArchetype); } // Creating an archetype invalidates all iterators / jobs etc // because it affects the live iteration linked lists... EntityComponentStore.ArchetypeChanges archetypeChanges = default; if (m_IsMainThread) { BeforeStructuralChange(); } archetypeChanges = EntityComponentStore->BeginArchetypeChangeTracking(); entityArchetype.Archetype = EntityComponentStore->GetOrCreateArchetype(typesInArchetype, cachedComponentCount); EntityComponentStore->EndArchetypeChangeTracking(archetypeChanges, EntityQueryManager); return(entityArchetype); }
internal EntityArchetype CreateArchetype(ComponentType *types, int count) { ComponentTypeInArchetype *typesInArchetype = stackalloc ComponentTypeInArchetype[count + 1]; var cachedComponentCount = FillSortedArchetypeArray(typesInArchetype, types, count); // Lookup existing archetype (cheap) EntityArchetype entityArchetype; entityArchetype.Archetype = EntityComponentStore->GetExistingArchetype(typesInArchetype, cachedComponentCount); if (entityArchetype.Archetype != null) { return(entityArchetype); } // Creating an archetype invalidates all iterators / jobs etc // because it affects the live iteration linked lists... EntityComponentStore.ArchetypeChanges archetypeChanges = default; if (m_IsMainThread) { EntityManager.BeforeStructuralChange(); archetypeChanges = EntityComponentStore->BeginArchetypeChangeTracking(); } entityArchetype.Archetype = EntityComponentStore->GetOrCreateArchetype(typesInArchetype, cachedComponentCount); if (m_IsMainThread) { var changedArchetypes = EntityComponentStore->EndArchetypeChangeTracking(archetypeChanges); EntityQueryManager.AddAdditionalArchetypes(changedArchetypes); } return(entityArchetype); }
private static void _forward_mono_PlaybackChainChunk(EntityDataAccess *mgr, Unity.Collections.LowLevel.Unsafe.UnsafeList *managedReferenceIndexRemovalCount, ref EntityComponentStore.ArchetypeChanges archetypeChanges, ref ECBSharedPlaybackState playbackState, ECBChainPlaybackState *chainStates, int currentChain, int nextChain, bool isFirstPlayback, PlaybackPolicy playbackPolicy) { Managed._bfp_PlaybackChainChunk((IntPtr)mgr, (IntPtr)managedReferenceIndexRemovalCount, ref archetypeChanges, ref playbackState, (IntPtr)chainStates, currentChain, nextChain, isFirstPlayback, playbackPolicy); }
private static void PlaybackChainChunk(EntityDataAccess *mgr, Unity.Collections.LowLevel.Unsafe.UnsafeList *managedReferenceIndexRemovalCount, ref EntityComponentStore.ArchetypeChanges archetypeChanges, ref ECBSharedPlaybackState playbackState, ECBChainPlaybackState *chainStates, int currentChain, int nextChain, bool isFirstPlayback, PlaybackPolicy playbackPolicy) { #if !UNITY_IOS if (UseDelegate()) { _forward_mono_PlaybackChainChunk(mgr, managedReferenceIndexRemovalCount, ref archetypeChanges, ref playbackState, chainStates, currentChain, nextChain, isFirstPlayback, playbackPolicy); return; } #endif _PlaybackChainChunk(mgr, managedReferenceIndexRemovalCount, ref archetypeChanges, ref playbackState, chainStates, currentChain, nextChain, isFirstPlayback, playbackPolicy); }