- Home /
How to access Animator state of other collider?
I tried this:
int otherAttackingState = other.gameObject.GetComponent<Animator> ().StringToHash ("Base Layer.attacking");
Got following error message:
Assets/Scripts/Attacking.cs(45,94): error CS0176: Static member `UnityEngine.Animator.StringToHash(string)' cannot be accessed with an instance reference, qualify it with a type name instead
Any solutions?
Thanks in advance!
Answer by DiegoSLTS · Oct 07, 2015 at 01:18 PM
StringToHash is a static method. It means you have to write:
Animator.StringToHash("BaseLayer.attacking");
Put the class name only, not a reference to an actual Animator instance.
Your answer
Follow this Question
Related Questions
How to interrupt ALL but one animation state? 0 Answers
Not able to use a Vector as a condition in Mecanim? 2 Answers
Animator not registering changes in parameters. 0 Answers
NavMeshAgent animation - sliding 2 Answers
How do you play an animation in reverse? 0 Answers