Animator.GetFloat returning wrong value unity
So basically i am currently experiencing a problem in my game i am making in unity. This may just be because im new and inexperienced but i cant seem to find anything related to my issue online. the issue is i have a level with a bunch of AI zombies and that works well enough for now but if instantiate a new prefab zombie of the same type, the new zombie will act the same and set perameters in the animator the same although this is where the problem occurs... these instantianted AI for what ever reason call the Animator.GetFloat function passing the same thing as the other non instantiated AI but this time it will always seem to return 0 and for the life of me i cant figure out why. picture one here shows that i am currently using this animation and its setting this perameter to one using animation curves which is exactly what i want.
The problem then comes up in the code. where the call seems to return a wrong value
UPDATE: Sometimes the first spawned zombie will be able to get that value. idk why
What is the value of _parameterHash
?
By the way, it's completely pointless to compute the hash of the string and use this hash right away in the OnTriggerStay
, the purpose of the hash is to compute it once.
Your answer
![](https://koobas.hobune.stream/wayback/20220612221148im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Sumo Physics Bounce Question 0 Answers
Help with drift physics 0 Answers
Rotate sphere to the direction of movement 0 Answers