Hi,
i am new here, this is my first post. I hope someone can help me.
I made a search with no success about this problem.
I created a system where a cube spawn in the world from drag&drop operation from an inventory
widget (situated on the side of the screen like an hotbar).
this cube is an actor that has a static mesh and a widget
In game once you click on the cube the widget appear and it has three buttons:
1 to turn the cube 2 to destroy it 3 to make the widget disappear again
and it works
BUT if i create another cube and click on the widget to make it rotate it makes rotate the
first cube i created before. The same if i click on destroy.
When possible, you could provide a bit more information about your blueprint/widget logic and how they interact with each other? This will help me get a better idea as to what may be going on in your code.
Still, I would like to take a stab at helping you fix what may be going on here. But from what you provided so far, it sounds like you code is working as it should, it’s just that whenever you click on your widget to move or destroy the box, that this action is still being done on the original box which you have made. There could be a few reasons for this.
The first line of defense for this sort of thing is to just try to duplicate the box blueprint that you currently have. You can do this by selecting it and pressing ctrl + d.
But I am assuming that this has something more to do with how you are casting to your box(let me know if you are using a cast to access data about your box).
If this is the case, it is important to tell Unreal which box that you want to cast to. For your case, the simplest way of doing this would be to shoot a line trace out of your character to the box that you would like to affect and use the reference of the box (which the line trace hit) to inform your widget blueprint about which box the action should be made towards (for destroying, moving, etc.).
If you need some advice about how to get any of this sort of stuff to work or you don’t understand, I would be happy to explain