This works, but I don't feel it's the optimal solution

if (targetAttackAnim != null && !skeletonAnimation.state.ToString().Contains(targetAttackAnim.Name)) {
nicmar
1 year ago
Harald
AnimationState.ToString()
, use AnimationState getCurrent
to query the TrackEntry
at a given trackIndex
. 1 year ago
nicmar
1 year ago
Harald
While it's not optimal in terms of unnecessary computation (many string comparisons are rather costly, reference comparisons are of course better here), it most likely won't be noticable with only a few characters. It's just that code maintenance will become harder and the number of branches or if-conditions might multiply when explicitly querying every possible animation.nicmar さんが書きました:Is this something that could be wasteful to resources? This code is run on each frame, and the ActionState is set from different places.
changes from one to another state
from the code that is performed when already in a state
. 1 year ago