Search Unity

Exception with EntityCommandBuffer example

Discussion in 'Entity Component System' started by BackgroundMover, Feb 18, 2020.

  1. BackgroundMover

    BackgroundMover

    Joined:
    May 9, 2015
    Posts:
    224
    With Entities 0.6, Unity 2020.1.0a23, I tried pasting in the EntityCommandBuffer example code from the manual here.

    I had to add the required using statements, and add a [GenerateAuthoringComponent] on the Lifetime component. When running a scene with a GameObject with a Convert component, and a child with a Lifetime component, it throws an exception:

    InvalidOperationException: The previously scheduled job LifetimeSystem:<>c__DisplayClass_OnUpdate_LambdaJob0 reads from the UNKNOWN_OBJECT_TYPE <>c__DisplayClass_OnUpdate_LambdaJob0.safety. You must call JobHandle.Complete() on the job LifetimeSystem:<>c__DisplayClass_OnUpdate_LambdaJob0, before you can deallocate the UNKNOWN_OBJECT_TYPE safely.
    Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <fb900ccbd717476f91b221d941550640>:0)
    Unity.Entities.ComponentSafetyHandles.CompleteAllJobsAndInvalidateArrays () (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentSafetyHandles.cs:73)
    Unity.Entities.ComponentDependencyManager.CompleteAllJobsAndInvalidateArrays () (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentDependencyManager.cs:128)
    EntityDataAccess.BeforeStructuralChange () (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/EntityDataAccess.cs:91)
    EntityDataAccess.AddComponent (Unity.Entities.UnsafeMatchingArchetypePtrList archetypeList, Unity.Entities.EntityQueryFilter filter, Unity.Entities.ComponentType componentType) (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/EntityDataAccess.cs:235)
    Unity.Entities.EntityManager.AddComponent (Unity.Entities.EntityQuery entityQuery, Unity.Entities.ComponentType componentType) (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/EntityManagerChangeArchetype.cs:225)
    Unity.Transforms.ParentSystem.UpdateNewParents () (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Transforms/ParentSystem.cs:231)
    Unity.Transforms.ParentSystem.OnUpdate (Unity.Jobs.JobHandle inputDeps) (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Transforms/ParentSystem.cs:373)
    Unity.Entities.JobComponentSystem.Update () (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/JobComponentSystem.cs:129)
    Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:182)
    UnityEngine.Debug:LogException(Exception)
    Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/Stubs/Unity/Debug.cs:19)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:186)
    Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:169)
    Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentSystem.cs:107)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:182)
    Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:169)
    Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ComponentSystem.cs:107)
    Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.6.0-preview.24/Unity.Entities/ScriptBehaviourUpdateOrder.cs:152)