Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

How do you make a separate blend tree asset?

Discussion in 'Animation Previews' started by HeyZoos, May 8, 2020.

  1. HeyZoos

    HeyZoos

    Joined:
    Jul 31, 2016
    Posts:
    50
    upload_2020-5-8_18-6-14.png

    How do you make the blend tree "separate"?

    When a I create a blend tree in an animation controller nothing shows up in the assets.
     
  2. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    I believe that a blend tree is embedded in the animation controller and can't be created on his own as an asset.
    You might want to take a look at animation controller override asset instead.
     
  3. HeyZoos

    HeyZoos

    Joined:
    Jul 31, 2016
    Posts:
    50
    Hmm, that doesn't seem to be it, I need the `BlendTree` to be an asset so it can be referenced by another script's `public BlendTree tree` property. I managed to create one by just copying the asset data, but I couldn't find a way to create one through the editor.
     
  4. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
  5. HeyZoos

    HeyZoos

    Joined:
    Jul 31, 2016
    Posts:
    50
    I'm following Unity.Animation samples along and this is the pattern they seem to follow.

    Code (CSharp):
    1. public class AnimationAuthor : MonoBehaviour, IConvertGameObjectToEntity, IDeclareReferencedPrefabs
    2. {
    3.     public BlendTree BlendTree;
    4.     public GameObject RigPrefab;
    5.  
    6.     public void Convert(Entity entity, EntityManager manager, GameObjectConversionSystem converter)
    7.     {
    8.         ...
    9.  
    10.         var blendTreeIndex = BlendTreeConversion.Convert(BlendTree, rigEntity, manager, bakeOptions);
    11.         manager.AddComponentData(rigEntity, new BlendTreeIndex { Value = blendTreeIndex });
    12.     }
    13. }
     
  6. HeyZoos

    HeyZoos

    Joined:
    Jul 31, 2016
    Posts:
    50
  7. HeyZoos

    HeyZoos

    Joined:
    Jul 31, 2016
    Posts:
    50
    From there the inputs to the blend tree are generated by a data flow graph (I think)
     
  8. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    I'm honestly not sure about all that. The only thing I know is that you can create a blend tree in an asset in advance and override the animations using the "animation controller override" asset. That's what I do.