I have reference to an AnimatorControllerParameter
, and wish to access its ID
.
How would that be done?
I want to do something like this, where p.id
is the parameter ID
I want to get:
foreach( AnimatorControllerParameter p in animator.parameters )
if( p.type == AnimatorControllerParameterType.Trigger )
{
animator.ResetTrigger(p.id);
}
//I'm trying to avoid using animator.ResetTrigger(p.name); for performance reasons
I know you could get a parameter ID using a parameter’s name Animator.StringToHash(p.name)
, but that defeats the purpose to improving performance
Edit:
Just found AnimatorControllerParameter.nameHash in the API. Is that the same as a parameter’s ID? All that the documentation says is that it
Returns the hash of the parameter based on its name
Does nameHash
go through the same process as Animator.StringToHash(p.name)
then?)