Move to location works only when I recompile it

Hello,

I’m new to UE5 and I’m trying to move an actor with the mouse like a RTS :

I created a BP_Creature that I can select. When it’s selected, a right click should move it to the mouse location.

My event called by the right click :

My moving function from the BP_Creature :

When I remove the link between GetAIController and the MoveToLocation, I save and compile then reset the link and try my game, the movement works. If I close the game and rerun, it’ doesn’t work anymore. Even if I don’t make any modification.

I have to redo the same manipulation as explained before to make it work. So I’m asking myself : is it a bug ? Am I doing it wrong ?

hi, did you try ai move to bp node?

Hi,

Thanks for your answer

I couldn’t create AiMoveTo inside my function so I recreated it in the graph editor but it always return fail. When I put a break point, “movement result” is “aborted”

hi, it has to do something with destination vector i believe. can u give some other location and see if ai move to works? first ai move to node to success, is what we should see i think ..

Hi,

I simplified the function and made some tests :

the “spawnactor” spawn a black ring to see the destination of the hit result

On the video, we can see that the hit location seems good (thanks to the print string) and the black ring is always spawn at the right location but still no move

good that, you are printing out location. can you print success and fail and movement result on fail too? also, can you place your actor somewhere to the side and give 0,0,0 and see if it moves to center (just for testing of ai move to).

Hello,

Sorry for the late answer, I wasn’t home lasts days.

I tried to put a vector set to 0,0,0 as parameter to ai move to. At first it didn’t work.

So I lowered the floor so that it was aligned with Z 0 and my pawn move to 0,0,0.

So I put my mouse position as parameter and it still work.

The fact that the floor wasn’t alligned with Z=0 seems to be the issue.

Thanks again for guiding me in the right direction.

great, so are you clear now? if yes, please keep this as solved, so people will see other posts - like who wanted to answer the questions etc ..

Yes, I’m clear. Thanks again, I’ll put your help as resolve. Have a nice day