Search Unity

Custom Properties in Playables graph

Discussion in 'Animation' started by Alex_StudioDrydock, Dec 4, 2019.

  1. Alex_StudioDrydock

    Alex_StudioDrydock

    Joined:
    Jan 16, 2019
    Posts:
    9
    Hi, I have some FBX animations with custom properties (i.e., "Animated Custom Properties" ticked on import). When using an AnimatorController, I can read these properties from a script by creating a parameter of the same name and calling Animator.GetFloat.

    How can I achieve the same result using the Playables API? I have a PlayableGraph (with AnimatedClipPlayables that contain custom properties) targeting an Animator, but calling Animator.GetFloat always returns 0.

    Thanks!
    Alex.
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    As far as I know, you simply can't. That's just one of the limitations of the Playables API.

    The best workaround I've been able to come up with is a ScriptableObject which I've called an ExposedCurve. It basically just references an AnimationClip and lets you pick a curve from it which it extracts in the Unity Editor and serializes separately so you can access the curve through it at runtime. Its source code is included in the Lite version so you can just grab it if you don't actually want to use Animancer (though I highly recommend you try it).