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.

Avatar's Child meshes are improperly converted during authoring?

Discussion in 'Data Oriented Technology Stack' started by HeavensSword, May 18, 2021.

  1. HeavensSword


    Jun 11, 2015

    We are currently trying to transition an existing project over to Unity DOTS for the sake of performance.

    I have an Avatar prefab that I am attempting to convert into an Entity. Things seem to be converted for the most part, but the avatar has child meshes that are "exploded" out after conversion.

    Screen Shot 2021-05-14 at 4.37.43 PM.png

    Here's a shot of the prefab, note that the skinned mesh renderers are included as children of the Parent object while the Animator is on the Parent:

    Screen Shot 2021-05-18 at 2.14.09 PM.png

    I also have the "ConvertToEntity" script (Convert And Destroy) and my own AI Agent Authoring conversion script attached.
    All my conversion script does is add a Tag and AnimState Component.

    I use an Authoring Spawner to DeclareReferencedPrefabs (using the prefab shown in the image above).

    I thought that maybe if I initialized the Animator to something it may fix it, but that doesn't seem to be the case.

    The Animator is added using AddHybridComponent and then updated in a System where currently I just always set it to an Idle animation for now.

    Code (CSharp):
    1. [UpdateInGroup( typeof( PostSimulationSystemGroup ) )]
    2.     public sealed class AnimatorRefSystem : SystemBase
    3.     {
    4.         protected override void OnUpdate()
    5.         {
    6.             Entities.WithoutBurst()
    7.             .ForEach( ( Animator animator, in AvatarAnimState animState ) =>
    8.             {
    9.                 animator.SetBool( "OnGround", true );
    10.                 animator.SetBool( "StandingIdle", true );
    11.             } ).Run();
    12.         }
    13.     }
    At this point I'm wondering if it's just an issue with how our Avatar's are formatted; is it fine to have multiple SkinnedMeshRenderers arranged like this? Will ConvertToEntity handle this situation correctly?
    Using Convert And Inject will have the Avatar created correctly, but from my understanding, Convert And Inject is more for development and testing?

    Last edited: May 19, 2021