Problem when two Anim state transitions start in the same frame

Hi, I have a problem during gameplay where once in a while two transitions are issued (conditions become true) in the same frame. When this happens, it seems one is chosen by the system arbitrarily. If shoot and die happens at the same time, this can mean shoot gets played and die does not. In the code I can prevent this from happening in most cases, but not for transitions that are automatic like returning from a state that finishes playing. Is there a way I can control this better? Currently transitions from “Any” state have lower priority than other transitions, and I think this is not good. At least in our project, “Any” state transitions are considered more important than the other transitions, eg. die is more important than shoot and reload.

@Elliott Did we talk about transition priority before? Any way to work around this?

1 Like

Hey, transitions in a state graph have a local priority (multiple transitions set up between two states have a priority order) but there is no equivalent on a global level. The flow through a state graph on a global level is handled via parameters instead. You can set up the transition to the shoot state to have a condition which checks that the player is not currently dead.

Regarding any state transitions being more important than normal transitions, it’s something we’ll have to evaluate going forward as the anim state graph evolves and we learn more about how it’s being used. We’ll soon be releasing animation layer masks and blending which will allow you to smoothly blend between animation layers. As subsequent layers overwrite previous layers it’ll be possible to blend into a different state graph layer which has a higher priority than the last. This should further alleviate these kind of issues.


Good idea, I can add conditions to avoid that two transitions can ever happen at once. A lot of transitions with a lot of extra conditions, though, in an already complex state graph, but I’ll give it a go.