Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Proper way to change parent

Discussion in 'Entity Component System' started by rjohnson06, Feb 21, 2020.

  1. rjohnson06

    rjohnson06

    Joined:
    May 27, 2017
    Posts:
    17
    Does anyone know the proper way to change an entity's parent? I am able to change the parent, but I get a ton of errors after doing so:

    ArgumentException: The entity does not exist
    Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, Unity.Entities.ComponentType componentType) (at Library/PackageCache/com.unity.entities@0.5.0-preview.17/Unity.Entities/EntityComponentStoreDebug.cs:231)
    Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, System.Int32 componentType) (at Library/PackageCache/com.unity.entities@0.5.0-preview.17/Unity.Entities/EntityComponentStoreDebug.cs:239)
    Unity.Entities.ComponentDataFromEntity`1[T].get_Item (Unity.Entities.Entity entity) (at Library/PackageCache/com.unity.entities@0.5.0-preview.17/Unity.Entities/Iterators/ComponentDataFromEntity.cs:133)
    Unity.Transforms.LocalToParentSystem+UpdateHierarchy.ChildLocalToWorld (Unity.Mathematics.float4x4 parentLocalToWorld, Unity.Entities.Entity entity) (at Library/PackageCache/com.unity.entities@0.5.0-preview.17/Unity.Transforms/LocalToParentSystem.cs:31)
    Unity.Transforms.LocalToParentSystem+UpdateHierarchy.Execute (Unity.Entities.ArchetypeChunk chunk, System.Int32 index, System.Int32 entityOffset) (at Library/PackageCache/com.unity.entities@0.5.0-preview.17/Unity.Transforms/LocalToParentSystem.cs:65)
    Unity.Entities.JobChunkExtensions+JobChunk_Process`1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkData`1[T]& jobData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.5.0-preview.17/Unity.Entities/IJobChunk.cs:208)
    Unity.Entities.JobChunkExtensions+JobChunk_Process`1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkData`1[T]& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.5.0-preview.17/Unity.Entities/IJobChunk.cs:192)
     
  2. rjohnson06

    rjohnson06

    Joined:
    May 27, 2017
    Posts:
    17
    Actually this looks like it's really an issue with destroying an entity that has a parent