Whenever the StateMachine would encounter an AnimationState it would assume that the corresponding stateInstance would be an AnimationStateInstance. This wasn't always the case as AnimationStates can sometimes not point to an Animation (at edit time this is allowed). At runtime we had thought we could be smart about this and simply return a different "empty" State which doesn't do anything (what we call a SystemState) as the corresponding stateInstance, but this would trigger bad casts which a memory sanitizer helped point out.
The fix applied here is to ensure that those assumptions are valid by returning an AnimationStateInstance with an empty animation, which is exactly how the editor behaves too.
Whenever the StateMachine would encounter an AnimationState it would assume that the corresponding stateInstance would be an AnimationStateInstance. This wasn't always the case as AnimationStates can sometimes not point to an Animation (at edit time this is allowed). At runtime we had thought we could be smart about this and simply return a different "empty" State which doesn't do anything (what we call a SystemState) as the corresponding stateInstance, but this would trigger bad casts which a memory sanitizer helped point out.
The fix applied here is to ensure that those assumptions are valid by returning an AnimationStateInstance with an empty animation, which is exactly how the editor behaves too.