Endless runner: Why state machine bypass Spawn animation state and go instant to Run animation state?

Hello !
I am developing an endless runner and I use EVENT TICK in BP_MainCharacter to trigger endless run.
What is the correct way for the game to start with SPAWN animation state and then continue with RUN animation state?

I am asking because now it happens to me that the game starts right away with the RUN animation state.

Or it happens to me that the SPAWN animation state is activated and as it completes the vector continues to move the character forward without activating the RUN animation state.

Where am I going wrong? Do you have any suggestions?
Thank you for your time



1 Like

For animations that are outside the locomotions like in your case, I recommend using anim montages because it would be unnecessary to have it as a state in your anim blueprint if it’s already gonna be played only once.

To turn an existing animation into a montage, you should right click on your asset in the content browser, navigate to the “Create” option and select the “Create Anim Montage” button. Then, navigate to your anim blueprint’s main anim graph, the one you can access by clicking on the “Anim Graph” text on top of the screen and below the tabs, and not the other graphs inside your locomotions. Right click on an open space, search for “Default” and get the default slot of your character. It should be a grey node. Then plug it’s both input and output execution pins accordingly. This was a necessary step in order to make the anim montages work.

To play the anim montage, navigate to your character blueprint’s event graph and get a “Play Montage” node. Select an anim montage to play from the dropdown menu inside the node and plug the node to the Event Begin Play node.

And finally, to make the character start running after the animation is complete, you can simply create a bool type variable and set it to true after the “On Completed” pin of the Play Montage node, and bind the condition to allow running only if that variable is true by using a branch node.

Hope this helps! :blush:

1 Like

I already tried but without solving, maybe I did something wrong that I don’t see?


I think the branch is in the wrong place. It should be placed after the Event Tick node where you start the continuous running. What you should plug in after the on completed pin of the Play Montage node is the set node of that variable and set it to true.

Ok now it works halfway, you see SPAWN animation, then RUN animation comes on, but the vector doesn’t scroll basically the character runs in place without advancing.
It also no longer accepts input to move sideways or even input to sliding

1 Like

It’s currently not possible for me to know what might be the issue. How did you handle the running logic previously and which aspects of it has changed after implementing my suggestion? Please provide all the related blueprint code.

1 Like

I only added the code you suggested as I showed in these pictures.

If I remove the montage and the added code, the input controls go back to working: right, left and sliding.

I think the problem is with the TICK and montage, I also tried adding DO ONCE before/after the montage.

Thank you very much for your support, and I don’t want to overcommit, so let’s see if any other suggestions come out.
In the meantime, I will continue with the code.
After all, this problem is a detail/refinement that I can postpone solving. :slightly_smiling_face:

1 Like

You see, you haven’t provided the necessary screenshots of the correct implementation of my suggestion. I also currently don’t have access to what’s going on after your Event Tick node. And your new issue seems to be related with how you handle your continuous running logic. So not only me, but nobody else can help you on this matter without you sharing all the related parts of your blueprint code.

The code is very simple, it allows the character to run to the infinite, but if I add the part of the code you suggested it happens that SPAWN animation is activated, then RUN animation is activated, but it runs in place and all inputs: left, right and sliding no longer work.

This is the working code without the PLAY MONTAGE part.

do you need more code?

Yes I do in fact :grin: because I can’t tell you what goes wrong after you implement my suggestion without seeing how you do it first


Like I mentioned before, instead of that branch node that you connected to the “on completed” pin of the Play Montage node, you should have a “Set” node for your variable, and set it to true.

Unfortunately, the result does not change.
SPAWN animation followed by RUN animation is activated, but the character runs in place without advancing and the motion inputs do not work.

Connect the rest of your code starting from the function named “Sliding” to the default output execution pin of the Play Montage node (the one at the very top with no label next to it) while keeping the Set node after the on completed pin.

Like this? same thing, runs on the spot and the controls don’t work

Did you try printing out the variable? If the issue starts occuring after these changes, it must be due to the variable not being set to true. You can check this by plugging a print string node after we set it to true. Now if that’s the case, I got a guess on why that’s happening.

It might be because the Event Begin node doesn’t run anymore after the first frame, therefore there’s no execution flow that can trigger the Play Montage node’s on completed pin. If I’m right about this, you can simply solve this by triggering a one shot delay that’s the duration of your spawning animation after your Event Tick node. You can achieve that by getting a branch node, plugging a delay node into it’s false pin, setting a bool type variable to true after the delay, plugging that variable into the condition pin of the branch node, and connecting the rest of the code that you execute after the Event Tick into it’s true pin.

1 Like

Dont print

Now i’m triyng your second part…

Command input movement: left right work, but not slide so I thinnk the problem is the vector because sliding works with vector forward.
Character run in place dont go forward.

Like I said, you should set your variable named “Is Spawned” to true after your delay node

Now it’s works!

Thank you so much for your support, time and patience!

1 Like