Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Avatar's Child meshes are improperly converted during authoring?

Discussion in 'Entity Component System' started by HeavensSword, May 18, 2021.

  1. HeavensSword

    HeavensSword

    Joined:
    Jun 11, 2015
    Posts:
    20
    Hello,

    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?

    Thanks.
     
    Last edited: May 19, 2021