Closed dragon122 closed 4 months ago
Hi, thanks for reporting
Please upgrade to 2.3.3 to see if it's fixed.
Please note: upgrade to 2.3.3 won't break the current API, but AnimatorState
that already serialized MIGHT be reset to blank, please manually sign again to fix it.
public class Anim : MonoBehaviour
{
[AnimatorState, OnValueChanged(nameof(OnChanged))]
public string stateName;
[AnimatorState, OnValueChanged(nameof(OnChangedState))]
public AnimatorState state;
// This does not have a `animationClip`, thus it won't include a resource when serialized: only pure data.
[AnimatorState, OnValueChanged(nameof(OnChangedState))]
public AnimatorStateBase stateBase;
private void OnChanged(string changedValue) => Debug.Log(changedValue);
private void OnChangedState(AnimatorStateChanged changedValue) => Debug.Log($"layerIndex={changedValue.layerIndex}, state={changedValue.state}, animationClip={changedValue.animationClip}, subStateMachineNameChain={string.Join("/", changedValue.subStateMachineNameChain)}");
}
Now every time I try to select a state from the dropdown list, it throws "ArgumentOutOfRangeException: Index was out of range" ("curIndex" aways = -1 in "AnimatorStateAttributeDrawer.cs" line 127) The script\animator is newly created, same code as in the example above.
Oh god... I made a typo when fixing it...
Sorry, fixing it again... on the way...
It's been updated to version 2.3.4. Please have a try (hope it's all good now. 😳 such an embarrassing bug)
Everything works perfectly. Great job and quick response. Keep up the good work!
Animator's Sub-State machines are a great way to reduce clutter inside the Animator and is a must for any more or less sizable project. Sadly, AnimatorStateAttribute cannot provide states inside SSMs.