so my problem is, im trying to make a tower defence game and when i try to upgrade a tower that has a duplicate it always upgrades the first one i placed in order, i currently have it setup with a box collision on clicked to get a widget with the upgrade option, i think i need to get a reference to the tower clicked and put it on the target of upgrade on the widget but for the life of me i cant figure out how too, Im new at this this is my first game so any help would be greatly appreciated
Sounds like you’re using ‘get actor of class’, which will typically give you the actor that was first placed in the level.
How does the player choose the tower?
Yeah i am using it, i am not sure how to reference the actor most recently clicked. i choose the tower i want to upgrade by clicking on it using a box collision
Right, so you have a two ways of knowing which actor that is. One is, you just clicked on it, the other is, you’re overlapping it.
Can you not pass the actor reference from one of these actions to the upgrade process?
tbh im not sure how too
ahh yeah yes it is, both the event upgrade and on clicked are in tower the other is a widget graph
i changed the on clicked from box to self so i get the touched actor instead
Make an actor variable in the widget, make it instance editable and expose on spawn
when you make the widget, you can pass the reference
you are quite literally the best thing thats happened to me in 3 days thankyou so much
works perfectly