- Home /
Get Mecanim State Name String?
Pretty much. I'm basically doing a setup where I have blank states between attack animations that all have the same name except for a number at the end, which are used as 'interim' states to check if the player has pressed a button before the next attack animation starts, if so, continue the combo, if not, revert back to the idle animation.
However, the sticking point is actually getting the relevant part of the name of the state that I want, the number is irrelevant, but I can't get the name in a string form. I could get around this by cheating with a quick for loop that goes through a whole bunch of numbers quickly and constantly, but that seems awfully wasteful. The problem is, Animator has no actual way of providing the state name in a string, only a hash, and there's no real way to convert it to a proper string. It's actually bewildering how such a simple and what should be necessary function be unavailable.
So, yeah, any idea of how to actually get the name of a state in string form?
I personally prefer to not take any information "back" from mecanim - it is just messy. $$anonymous$$aybe just calculate the right animation state outside and give an integer value to mecanim to change from "any state" to the right animation!
Yeah, I'm not finding this feature anywhere. And we're in fricking 2016 now.
Your answer
Follow this Question
Related Questions
Unity 5 - nameHash obsolete? shortNameHash vs fullPathHash 0 Answers
Mecanim. Change state under parameter condition problem. 1 Answer
SetAnimationClip on mecanim State using script 0 Answers
Problem with mecanim states switching back for a split second 0 Answers
Macanim Mouse Buttons interaction c# 1 Answer