Search Unity

Animating a different GameObject's Animator param value?

Discussion in 'Animation' started by FutzyCody, Sep 17, 2021.

  1. FutzyCody

    FutzyCody

    Joined:
    Feb 21, 2021
    Posts:
    2
    In the Unity editor, I'm attempting to create an animation curve associated with GameObject P, which varies the value of another Animator's parameter (associated with GameObject Q), but that other animator's parameter doesn't show up as an animatable property in the 'Add Property' dropdown of P's animation, even if Q is a child of P. The only way the parameter shows up as an available property is if it P & Q are actually the same object (i.e,. the Animator contains an animation curve which updates its own parameter).

    Is this by design, or am I missing something? What I'd really like is for P to be somewhere else in the GameObject hierarchy, separate from Q for organizational purposes, though I can make it work having all the animations on the same object.

    Also, a little background: I'm working in an environment which doesn't allow any custom scripts, so I can't write any code: I have to stick with the stock behaviors of the built-in Unity components that the editor exposes.
     
  2. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    244
    Hey,

    I'm assuming this is by design, or lack thereof. I've never heard of anyone needing to animate an animator parameter from a different animator controller.

    Unless I'm missing something, I think what you're trying to do is incredibly niche, and there's probably a million better ways of accomplishing it. It's unfortunate that you can't write any code, because you could probably write a simple script that could set the animator's parameters for you.
     
  3. FutzyCody

    FutzyCody

    Joined:
    Feb 21, 2021
    Posts:
    2
    > I've never heard of anyone needing to animate an animator parameter from a different animator controller. ... I think what you're trying to do is incredibly niche

    Agreed.

    In my specific case, I'm using P to modify how Q animates: speed, cycle offsets, values used in transition conditions, etc. This is mostly all to make up for the lack of scripting - instead of writing my logic out in code (where I would be able to refer to other objects), I have to create equivalent state machines, and express its output as values along an animation curve, and setting other scene values from them.

    That being said, conceptually, having a parent object's animator vary the parameters of a child animator controller doesn't seem any different than it varying the values of any other child's property/component, like position or ParticleSystem.velocity.

    Hmm, though for unrelated reasons, the other day I did have to hand-edit an .anim file to fixup some broken object paths when I moved a curve from one controller to another. I wonder if I could hand-edit to force the reference to the animation parameters here as well.
     
unityunity