Download

Use GUI Buttons to switch static meshes

I’m looking for a way to swtich between static meshes in my level.
I’m trying to make a level where i can change the meshes by clicking on GUI buttons which appear when you stand near them.

I just can’t figure out how to make the buttons interact with my Blueprint actors.

It probably is very easy to do, but i’m kind of new to UE4 and just can’t seem to find an answer to this problem.

hi,

when you say “stand near them”, means you have some Overlap event or something which could give you the info about the actor you stand near to right?

Question:
Do you use 3D Widgets or do you use HUD/Viewport Widgets?

I used a sphere collision in my Blueprint actor to create an overlap event to make the buttons visible.
For the buttons i used a Widget blueprint, so no 3d widgets.

hey again,

could you provide some screenshots of all blueprints which are part of your interaction?

  • the bp which creates the UMG Widget
  • the bp which reacts to overlap event
  • the bp which cause your overlap event

Ok, i changed the concept a bit to start of with.
What i have now is a widget with two buttons a “previous” and a “next” button.
Whan i click one of these buttons i will cycle through an array and print out a name to check if it is working.
251f36ca044a7011a31c6a025437b055a51abeb2.jpeg

Now i need to show the different furniture options i want to show.

I made 4 Blueprint actors and gave each one a static mesh.
a76bc48407323476b2b57671736939f5abff425d.jpeg

I put those together in an array (but i’m not completly sure if that is nescesary and if i did it correct)
array.jpg

Now what i want to achieve is that i can cycle through the 4 shapes i made when clicking on the Previous or next button.

I hope somebody can put me on the right track.

Set an “active” static mesh in its blueprint so that the visible mesh is whatever is selected. From your UMG just cast to your furniture blueprint to do ++ on the selected mesh in the array, or if its at the last index then go back to 0

i made some progress on what i want to achieve.

What i have done so far is:

I finally figured out how to communicate between the UMG blueprints, other blueprints and their variables. :stuck_out_tongue:

I made it possible to switch between the different furniture sets by making a scene for every set (seemd the smart thing to do because it doesn’t have to be loaded all the time, and there are comming a lot of child possibilities per set)
Still thinking how to get that hierarchy done.

For every set i need to change the width, and the possibilitie to change elements in the sets, and eventually the color of the different elements. :slight_smile:

But now i run in a small problem.
Like i said before i wanted the UMG to appear when near the furniture, that is no problem to achieve.
It also has to disappear when i get away from the furniture, also got that done with the “remove from parent” node
But the problem is, the umg also disappears when i click on the next or previous button and i have to move back and forth to get it back.

How can i resolve that issue?

I noticed it doesn’t happen with another button i added which doesn’t changes the scenes.
so how can i keep the UMG on screen until i leave the area?

[edit] I added a screenshot of the functions i made for the buttons to switch the furniture sets.
As you can see the first one has a Note which i don’t know what to do with (maybe it’s part of the problem)
4cd23c5d6364d8ffea135d642375f71943e10935.jpeg