Download

Spawned Pawn Not Moving - Placed Pawn Moving Fine

Soooo… I’m not even sure where to begin, or what I’m doing. Which is partly why I’ve just been faffing about with some trial and error. Since I havent really found any of the beginner’s tutorials all that helpful. I’ve also got problems concentrating, and wading through all that text when I’m looking for something specific is just too annoying.

What I’ve got, is a blueprint for a pawn. And in that blueprint, I’ve put some code to make it move. The code seemingly only triggers when I set it to Event Tick, and ONLY when I place the pawn manually and then run the game.
I’ve attached a sprite to it too, to be able to see it.

In the Level Blueprint, I’ve put in some code to spawn the blueprint pawn, which works a treat, except it doesn’t move.

Tried various events, but there doesn’t seem to be an Event for when spawned?

I don’t know what Event BeginPlay actually does, or how it works with anything. Like when does it consider play to have begun? When you press play? When you spawn it? It doesn’t seem to be doing anything.
Oh yes, and I should mention that I tried various other means of kickstarting it, like pressing a key. But when it has spawned, nothing happens.

Am I supposed to put the movement code somewhere else? I tried putting it in where I spawned it, but it wouldn’t have any of that. Just what exactly IS a blueprint?

So in conclusion; It works when placed. But when I spawn it in, it doesn’t trigger the movement. What do?
I’m using the 2D sidescroller example map, and what I’m trying to accomplish is;
Have a nonplayer controlled character spawn and move forward on its own.

Hello MutonElite,

You can do that with some different ways depending on the behavior you want for that enemy. For a simple movement, you can use the node “Add Movement Input” inside your enemy blueprint, plug that on your “Event Tick” and choose the world direction you want your enemy to move, for example you can use value -1 on x axis, so your enemy will move to left, or 1 on x axis and it will move to the right, also if you want some different movements you can play with that. Don’t forget to set his rotation so you can have enemy looking to the direction he is moving.
If you still have problems just let me know and i can make a print to show you.

Concerning your other doubt, the Event Begin Play will run after the game start, it will run one time, so its different of Event Tick that keep doing the actions again and again.

I’ve got that covered, and I did try out Event Tick, but it only seemed to work when the pawn was placed. This is what it looks like inside the pawn blueprint;

testingpawnshow.jpeg

And this is the spawning code from the level blueprint;

levelblueshow.jpeg

Probably you need to give it some time before setting Activate for the Character Movement to false? As i see it you’re trying to move but with no time to do it you turn it off so maybe that’s preventing the movement to happen at all.

The way you are doing there on your image you are not updating the movement, i made a setup, hope it helps you to understand, i forgot to mention on my previous reply to spawn controller, its necessary to make the enemy movement, sorry for that.

spawnactor.PNG

dd655193c6962784d26daf995686ee2083e920e3.png

That did it, thanks guys. :slight_smile: