Know the error: "All entities passed to EntityManager must exist". I get when deleting entities

Anyone know how to solve the error: “All entities passed to EntityManager must exist”. One of the entities has already been destroyed or was never created.

Hint #1, it happens when destroying Entities in EntityCommandBuffer.

Hint #2: Things worked before back in my old project so maybe it is a ComponentSystemGroup order thing?

Hint #3: I think I need that web page that says Burst Compiler Order of Operations. What I think is happening is an Entity is slated for delete, but another Job or SystemBase tries to reference it.

Deletion of the Entity happens in: [UpdateInGroup(typeof(InitializationSystemGroup))] before class & I use a BeginInitializationEntityCommandBufferSystem ERROR thrown in: [UpdateInGroup(typeof(FixedStepSimulationSystemGroup))] before class & uses an EndInitializationEntityCommandBufferSystem
Full error:

ArgumentException: System.ArgumentException: All entities passed to EntityManager must exist. One of the entities has already been destroyed or was never created.
This Exception was thrown from a function compiled with Burst, which has limited exception support. Turn off burst (Jobs → Burst → Enable Compilation) to inspect full exceptions & stacktraces.
EntityCommandBuffer was recorded in DOTS_DRONE_AI and played back in Unity.Entities.EndInitializationEntityCommandBufferSystem.
at (wrapper managed-to-native) System.Object.wrapper_native_000001B05C0F02A0(intptr,intptr,Unity.Entities.EntityComponentStore/ArchetypeChanges&,Unity.Entities.ECBSharedPlaybackState&,intptr,int,int,bool,Unity.Entities.PlaybackPolicy)
at (wrapper delegate-invoke) .invoke_void_intptr_intptr_EntityComponentStore/ArchetypeChanges&_ECBSharedPlaybackState&_intptr_int_int_bool_PlaybackPolicy(intptr,intptr,Unity.Entities.EntityComponentStore/ArchetypeChanges&,Unity.Entities.ECBSharedPlaybackState&,intptr,int,int,bool,Unity.Entities.PlaybackPolicy)
at Unity.Entities.EntityCommandBuffer._forward_mono_PlaybackChainChunk (Unity.Entities.EntityDataAccess* mgr, Unity.Collections.LowLevel.Unsafe.UnsafeList* managedReferenceIndexRemovalCount, Unity.Entities.EntityComponentStore+ArchetypeChanges& archetypeChanges, Unity.Entities.ECBSharedPlaybackState& playbackState, Unity.Entities.ECBChainPlaybackState* chainStates, System.Int32 currentChain, System.Int32 nextChain, System.Boolean isFirstPlayback, Unity.Entities.PlaybackPolicy playbackPolicy) [0x00001] in D:\unity\projectfiles\StarfighterGeneralOnSteam\Library\PackageCache\com.unity.entities@0.17.0-preview.42\Unity.Entities\EntityCommandBuffer.interop.gen.cs:88
at Unity.Entities.EntityCommandBuffer.PlaybackChainChunk (Unity.Entities.EntityDataAccess* mgr, Unity.Collections.LowLevel.Unsafe.UnsafeList* managedReferenceIndexRemovalCount, Unity.Entities.EntityComponentStore+ArchetypeChanges& archetypeChanges, Unity.Entities.ECBSharedPlaybackState& playbackState, Unity.Entities.ECBChainPlaybackState* chainStates, System.Int32 currentChain, System.Int32 nextChain, System.Boolean isFirstPlayback, Unity.Entities.PlaybackPolicy playbackPolicy) [0x0000b] in D:\unity\projectfiles\StarfighterGeneralOnSteam\Library\PackageCache\com.unity.entities@0.17.0-preview.42\Unity.Entities\EntityCommandBuffer.interop.gen.cs:69
at Unity.Entities.EntityCommandBuffer.PlaybackChain (Unity.Entities.EntityDataAccess* mgr, Unity.Collections.LowLevel.Unsafe.UnsafeList* managedReferenceIndexRemovalCount, Unity.Entities.EntityComponentStore+ArchetypeChanges& archetypeChanges, Unity.Entities.ECBSharedPlaybackState& playbackState, Unity.Entities.ECBChainPlaybackState* chainStates, System.Int32 currentChain, System.Int32 nextChain, System.Boolean isFirstPlayback, Unity.Entities.PlaybackPolicy playbackPolicy) [0x000c9] in D:\unity\projectfiles\StarfighterGeneralOnSteam\Library\PackageCache\com.unity.entities@0.17.0-preview.42\Unity.Entities\EntityCommandBuffer.cs:2026
at Unity.Entities.EntityCommandBuffer.PlaybackInternal (Unity.Entities.EntityDataAccess* mgr) [0x00390] in D:\unity\projectfiles\StarfighterGeneralOnSteam\Library\PackageCache\com.unity.entities@0.17.0-preview.42\Unity.Entities\EntityCommandBuffer.cs:1829
at Unity.Entities.EntityCommandBuffer.Playback (Unity.Entities.EntityManager mgr) [0x00001] in D:\unity\projectfiles\StarfighterGeneralOnSteam\Library\PackageCache\com.unity.entities@0.17.0-preview.42\Unity.Entities\EntityCommandBuffer.cs:1696
at Unity.Entities.EntityCommandBufferSystem.FlushPendingBuffers (System.Boolean playBack) [0x00097] in D:\unity\projectfiles\StarfighterGeneralOnSteam\Library\PackageCache\com.unity.entities@0.17.0-preview.42\Unity.Entities\EntityCommandBufferSystem.cs:227

Unity.Entities.EntityCommandBufferSystem.FlushPendingBuffers (System.Boolean playBack) (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/EntityCommandBufferSystem.cs:294)
Unity.Entities.EntityCommandBufferSystem.OnUpdate () (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/EntityCommandBufferSystem.cs:192)
Unity.Entities.ComponentSystem.Update () (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/ComponentSystemGroup.cs:472)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/Stubs/Unity/Debug.cs:19)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/ComponentSystemGroup.cs:477)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/ComponentSystemGroup.cs:417)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.17.0-preview.42/Unity.Entities/ScriptBehaviourUpdateOrder.cs:333)

Stop duplicating threads, please.

@hippocoder

1 Like

Please keep related issues grouped, thank you. Refer to your previous post @goodnewsjimdotcom