What is the benefit of using Animator.StringtoHash("")?
c#, unity-game-engine
Solution
`Animator.StringToHash` is used for optimization purposes. Comparing two `ints` is faster than comparing two `strings`.
This is mostly used when comparing many animation state. `Animator.StringToHash` will convert the name of the animator(`string`) to an id(`int`). You can them compare animation state with integers instead of strings.
You can learn more about this here.
Problem
Why should you use Animator.StringToHash("") while you can use animator component with strings?