It seems simple enough, but my ‘mAnimator.GetFloat(“Acceleration”)’ call always returns 0. However, in the Animator window I can see there is a value.
Here’s a quick snipped of code:
mAnimator.SetFloat("Acceleration", mAcceleration); //, 0.04f, Time.deltaTime);
// Debug the state changes
if (mLastState != mStateInfo.nameHash)
{
int lAccelerationID = Animator.StringToHash("Acceleration");
float lAcceleration = mAnimator.GetFloat(lAccelerationID);
Debug.Log("[" + Time.time + "] Animator state change: " + mStateLookup[mLastState] + " -> " + mStateLookup[mStateInfo.nameHash] + " Acc:" + lAcceleration);
mLastState = mStateInfo.nameHash;
}
Animations are running correctly and I can see the Acceleration value changing in the editor. I’m just surprised I can’t get it in code.
Is there a trick to this?
Thanks!