Problem with event firing forever

I’m having problems with an animation blueprint. I simplified my state machine to test this. I have two states here that are relevant. The first on the left is the initial state, “Stopped”. The transition to the second state “Out2Rotating” is set to true, and the transition back is set to false, so it immediately changes into the second state and stays there. There is a simple animation looping on this second state.

This transition from state “Stopped” to state “Out2Rotating” has an event that triggers at the end, called “TestEvent”.

After the transition happens and the second state is active, this event is called many times, forever, very fast. It is my understanding that setting an event to fire on “End Transition Event” should fire once as the transition ends and never again, but it keeps getting called. I also considered the possibility of the event being fired as the animation in that state loops, but that can’t be the case, as the animation is one second long, and this event is triggering much faster than that. At this point I’m completely at a loss.

Any help is appreciated.

Screenshots:
[SPOILER]

https://forums.unrealengine.com/core/image/gif;base64

[/SPOILER]

“Can Enter Transition” from Stopped state to Our2Rotatting state is always checked which means it will always enter the second transition…in every frame, many times per second.
You need conditions when to enter a specific state and when you exit from the state.
What is your condition from Out2Rotating to Stopped state? If you set it to false it will never back to the first state.
For example, you can use Animation Time remaining < 0.1 or create bool variable (or similiar) and control it with your blueprint.

That is incorrect. The transition that goes back to “Stopped” is set to false. That means after entering state “Out2Rotating” it should stay there. It cannot enter a state that is already active, there is no transition from “Out2Rotating” to itself, and even if there was, it would be another transition and would not be calling this event.

I know that. I changed my blueprint to simplify this test. I want the second state to be the final state and never to be left, that is the point. It’s not how my final blueprint is going to work, but I’m trying to understand and fix this issue first.

I mean when it’s in the Stopped state it will always enter Our2Rotating state and never enter another state.
I see that you want to stay in the second state. So where’s the problem? It’s in the second state and triggers always End transition in loop but it’s set to false so it can not exit. (that’s what I mean).

The problem is that the “Test Event” is set to trigger at the end of the transition, that is the transition from “Stopped” to “Out2Rotating”, as you can see in this screenshot. It is not set to trigger in the state itself, or in any part of the animation. Since the transition only happens once, the event should only be triggered once. But despite that it is getting triggered repeatedly.

I can’t think on how this is possible… Only way for this to happen is if the transition back from “Out2Rotating” to “Stopped” is being enabled, despite me setting it to false. I don’t know what could cause that though, if that is happening.

The logic of your transitions states are run every frame. Thus any events in the “current state” will run/execute every frame. Your Out2Rotating state doesn’t allow for an exit of the state. Once there it’s permanent. So execution of Test Event will happen every frame for the duration of the state.

You need to add logic on the Test event to prevent repeated “execution” of the events logic. OR transition to an idle variant of the same state.

e.g. Stopped -> Out2Rotating (test event) -> Rotating_Permanent(idle, stays here).

I think that your transition ends because there’s no condition and it’s always in the “state” End Transition so it can not exit and triggers Notify Event in every frame.

I just tried removing the returning state, the transition from “Out2Rotating” into “Stopped”. When I do that, the “Out2Rotating” state also never ends, as before, but now the event is only called once. So those suppositions must be wrong… It does seem like the returning state is being enabled somehow and the states are going back and forth.

If you remove the returning state your notification for the End Transition will not trigger in every frame. You previously have the returning state and set to false which means it stucked in End Transition of the second state.
So it’s correct what is written previously.

That makes no sense… If I don’t have a returning state, it should be stuck in the second state. Not stuck at the end of the transition. The event is not inside the state, is inside the transition.

No.
If you have a returning state it expect to return and you do not have condition so it’s stuck in the End Transition state -> it’s set to false and always stuck there.
If you do not have a returning state, it will stay in that state without returning condition.

But I had a condition. Like I said, this is simplified. Before this, the condition was tied to a variable. I can put the variable back there and the end result is the same.

Have you tried to set Start Transition Event on the same condition and print with AnimNotify to see when it triggers?
Also, you can try the same with the returning condition to see when it enters and leave the state.

I started the blueprint from scratch and I figured it out.

My second state had a looping animation. I wanted the return transition to only trigger when the animation was completed. So from google, someone suggested enabling the property “Automatic Rule Based on Sequence Player in State” in the returning transition. It worked, and now the transition back always happened at the end of the animation. I assumed this was it, but apparently enabling this completely overrules the transition condition. Disabling this value fixed the problem. I suppose I’ll have to find another way to prevent the transition from starting before the animation ends…

If you do not want to loop animation just uncheck Looped. If you want to return when the animation ends just use the following condition:
Time remaining < 0.1 and connect to Can Enter Transition

https://forums.unrealengine.com/filedata/fetch?id=1494192

1 Like

Thanks man, that worked :slight_smile: