Search Unity

Question Is there a way to bind the curves in AnimationClip to PropertyStreamHandle?

Discussion in 'Animation' started by SolarianZ, Feb 17, 2023.

  1. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    239
    Is there a way to bind the curves in AnimationClip to PropertyStreamHandle or PropertySceneHandle?

    I can bind a custom curve in AnimationClip to PropertyStreamHandle by using Animator.BindStreamProperty, the propertyName parameter is the name of custom Curve:
    Code (CSharp):
    1. var propertyName = "WalkCurve";
    2. var handle = m_animator.BindStreamProperty(m_animator.transform, typeof(Animator), propertyName);
    upload_2023-2-17_18-26-34.png

    And now I'm trying to bind curves in AnimationClip to a PropertyStreamHandle or PropertySceneHandle, what propertyName should I use?
    upload_2023-2-17_18-33-21.png
     
  2. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    239
    I tried to print all curves info, but there are many curves of the same name.
    Code (CSharp):
    1. var curveBindings = AnimationUtility.GetCurveBindings(m_clip);
    2. foreach (var curveBinding in curveBindings)
    3. {
    4.     Debug.Log($"CurveBinding: PropertyName={curveBinding.propertyName}, Path={curveBinding.path}");
    5. }
    upload_2023-2-17_18-37-31.png