Problem with spawn

Hi !
I have created a grid with snap grid and spawn a turret when the mouse is over something specific.

Like you see, we can formulate this like this: I verify if the actor is created, if not, I creat one, if yes, I move it according to the grid.

But when I play, if I put my cursor on the specific thing, it creat turrets until it is in front of us. Very weird…

your last line makes no sense could you clarify the issue a bit

Haha, @ThompsonN13, I was messing around with some physics objects spawning them at my mouse location in world space and if you click in the same spot really fast it would spawn the actors on top of each other and eventually they become so numerous they “pile up/fall over/are spawned slightly in front or behind the previous one”, but eventually what happens is you can block your camera with spawned actors. Looking at this setup and that last line (yea it was weird English but OP is prob not a native speaker) I believe that is the phenomena @Orseiko is referring to. Actors are being spawned on “tick” which is probably a terrible way to spawn things you are planning to “drag and drop” since that is slow and clearly the tick is overwhelming the screen with spawned actors! As for the actual issue, I don’t think you are getting the “is valid” function to evaluate to true. So tick is running wild spawning actors as fast as it can. There are a million ways to do this, tick is probably the worst way in my opinion. You should just have a custom event for turret spawning or something that is gated by a branchd boolean and once you spawn it set a boolean value to true to prevent further spawning events being called. Once the actor is placed where you like and you want to spawn a new one set the boolean back to false on placement and you will be ready to place another one.

thanks for the clarification. yea i didnt really look to closely at the script before but i agree spawning things on tick isnt a good way to go youll have a bad time that way. i personally prefer to use event driven actions so like you press a button and it creates your preview mesh.