Tower defence spawning towers

I am creating a tower defence and it a dead end i can’t in the life of me figure out how to spawn my towers the way i want them
ill give a description of what i am looking for. I have rocks that when the player clicks on them my umg UI opens so the player can select 1 out 4 or so
towers i am stuck at this part… i want to then if the player clicks the tower 1 the rock the player has selected gets destroyed and the tower spawns in its place
i have tried creating this in the umg graph, the level blueprint and the rock blueprint and cant get any results besides me finding i can destroy the rock in the level blueprint with any key attached to destroy actor so my guessing is i need to use the level blueprint… any help will be very appreciated

The levelblueprint is quite a bad place to do this. You would have to copy everything and wire up again each level you create which is quite a major pain in the rear end.

The trick is to provide the stone to the umg graph when you spawn it. (the editable checkbox and expose on spawn one). You already have to check if the click hit is a stone or check if on the stone if it got clicked when you create the widget. Just forward the stone actor (either self or the other actor from the hit event).

You get the vector of the stones location and spawn actor from class there. Just select the tower which the user clicked on in the umg menu as class and destroy the stone actor.

Did this help or should I upload some pictures later?

Cheers,
Erasio

some pictures would be alot of help thank you .just to explain some more for you i already have the umg menu pop up when i click the stone…

hey man sorry to bug you. i am trying to get the stone to the umg but haveing problems

How do you check if you are clicking on a stone? You have to do a trace somehow or the “get hit result under cursor”. You can in both cases break the hit result and get a resulting “other actor” which you can then cast to your stone. Just provide that result to your widget (the variable which should hold the actor inside of your widget needs the two checkboxes “editable” and “expose on spawn” active. Then if you select this widget class while creating it there will be one additional pin)

Sorry I didn’t post pictures. I’m a bit short of time today.