I have a scene that I setup with pretty heavy reliance on GameObjectEntity and ComponentDataWrapper (as in every IComponentData has a corresponding ComponentDataWrapper so I can assemble everything in prefabs).
I’m trying to destroy these GameObjects now. I can cleanly destroy the Entity in a job with PostUpdateCommands.DestroyEntity, but that doesn’t destroy the GameObject it’s associated with. If I destroy the game object, the OnDisable function seems to clean up the Entity immediately giving me
ArgumentException: All entities passed to EntityManager must exist. One of the entities has already been destroyed or was never created.
and
Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
Is this a bug in the system, or would the accepted solution be to destroy the Entity on the EntityCommandBuffer and trigger another component to wait for the end of the frame and cleanup the GameObject then?