Hello I am still new in using the Unreal Engine. I start my project with the shooter starter content. After follow a tutorial, I am able to change the static mesh object to another by shooting. This is the blueprint how I set.
But the button is not working. I know the “cast to destructive wall” need an object reference. In the event hit, the “other” pin will detect whether the object hit is same as the object references cast to. In the UMG button, What should I do to detect and get all the object match to the “cast to destructive wall”? How to change the static mesh to another by only click a button? Really appreciate if get any help or advice!
In the first two images, you know that your projectile is actually hitting something, and therefore the Event Hit is triggered.
In this case, where you want to change a static mesh of some actor, the widget doesn’t know what actor to change the static mesh on, unless you tell it. You can create a new variable on the widget, and make it of type DestructiveWall (you actually don’t need to cast then, as the variable knows what type it is), then on the button click, you’d change the static mesh of your referenced actor. Here’s a simple blueprint to show what I mean:
Hi, thank you for your reply. I followed exactly to the tips you give but it doesn’t work Is there any mistake on the actor? I am really sure the button can function (tried with set the visibility of button).
If the set static mesh return a false boolean, the image color at top of the gameplay will change to green. I also set the static mesh to movable. Why the set static mesh always return false?
If the set static mesh return a false boolean, the image color at top of the gameplay will change to green. I also set the static mesh to movable. Why the set static mesh always return false and the object did not change to new mesh?
I figured out why my button doesn’t work. Because the object reference did not specify which object is want to change (it is possible to have many same objects). After the object is defined as an array index ‘0’, the static mesh can be set!