Search Unity

Bug Bug with hybrid entities and disabled children in InstantiateCompanionComponentDelegate

Discussion in 'Entity Component System' started by slims, Jan 29, 2023.

  1. slims

    slims

    Joined:
    Dec 31, 2013
    Posts:
    86
    After upgrading to Entities 1.0 pre.15, I started getting exceptions during the map generation logic in my game. I tracked it down to one of the map items having a point light child which was disabled. Removing this disabled child from the prefab's hierarchy resolved the problem. This had been present in my .51 builds and even entities 1.0 exp with no issues. Also the bug never surfaces in the editor, only in release builds.

    Here's the stack trace:

    NullReferenceException: Object reference not set to an instance of an object
    at Unity.Entities.AttachToEntityClonerInjection.InstantiateCompanionComponentDelegate (System.Int32* srcArray, System.Int32 componentCount, Unity.Entities.Entity* dstEntities, System.Int32* dstCompanionLinkIndices, System.Int32* dstArray, System.Int32 instanceCount, Unity.Entities.ManagedComponentStore managedComponentStore) [0x0004c] in <065abad7a60a49a6a8f23c050db4d763>:0
    at (wrapper delegate-invoke) <Module>.invoke_void_int*_int_Entity*_int*_int*_int_ManagedComponentStore(int*,int,Unity.Entities.Entity*,int*,int*,int,Unity.Entities.ManagedComponentStore)
    at Unity.Entities.ManagedComponentStore.Playback (Unity.Entities.ManagedDeferredCommands& managedDeferredCommands) [0x001c3] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityDataAccess.PlaybackManagedChangesMono () [0x0000c] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityDataAccess.PlaybackManagedDirectly (System.Boolean& didTheThing) [0x00003] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityDataAccess.PlaybackManagedChanges () [0x00015] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityDataAccess.EndStructuralChanges (Unity.Entities.EntityComponentStore+ArchetypeChanges& changes) [0x00018] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityCommandBuffer+PlaybackProcessor.Cleanup () [0x000b6] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityCommandBuffer.PlaybackInternal (Unity.Entities.EntityDataAccess* mgr) [0x0011c] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityCommandBuffer.Playback (Unity.Entities.EntityManager mgr) [0x00008] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityCommandBufferSystem.FlushPendingBuffers (System.Boolean playBack) [0x0004e] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.EntityCommandBufferSystem.OnUpdate () [0x00000] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.SystemBase.Update () [0x00066] in <0ec06459091b4b729942383782def4c5>:0
    at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x0007a] in <0ec06459091b4b729942383782def4c5>:0
    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    UnityEngine.Logger:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    Unity.Debug:LogException(Exception)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems()
    Unity.Entities.ComponentSystemGroup:OnUpdate()
    Unity.Entities.SystemBase:Update()
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems()
    Unity.Entities.ComponentSystemGroup:OnUpdate()
    Unity.Entities.SystemBase:Update()
    Unity.Entities.DummyDelegateWrapper:TriggerUpdate()
     
    Last edited: Jan 29, 2023