[HELP] Widget instances, new user.

Hi everyone,

This is my first post, been using UE4 for about - near a month now, quite loving it :slight_smile:

Anyways, so here’s my problem, been trying to figure it out since last week. The scenario is;

a) I have an actor blueprint class that I named crateClass, represent a mesh - just a normal crate.

b) I have a menu created in widget blueprint class that I named actionWidget.

c) I set an event in my crateClass; ‘Actor On Click’ - which, when I click the box, it will ‘Create Widget’ -> ‘Add To Viewport’ (the actionWidget)

d) I have two crates in the game, lets name the first crate as crateA and the second crate is crateB.

e) As expected, when I click crateA, the widget will show up, THEN when I click crateB, the widget will show up too, HOWEVER the widgets are overlapping.

So, what I’m trying to do is; to remove the actionWidget shown (after I clicked - let say crateA) - when I clicked crateB, OR whenever I clicked other boxes (when there’s more than two boxes in the game)

I hope its not so confusing due to lack of screenshot (I’m at work at the moment, sorry xD).

So yeah basically that’s my current problem. Tried a lot of things (gate/vector dif etc) but I failed to solve it :(((

Any helps/tips/advices are so much appreciated.

Thanks!

AJ

Update:

  1. I’ve made the event create widget to trigger at Event Begin Play in crateClass, and made the created widget (actionWidget) as variable

  2. Now, instead of @onClick event -> Create Widget, it is now : @onClick -> Exec add to view port (actionWidget)

Update:

I managed to solve this, and posting it, perhaps it may help other users who experiencing the same problem, thou I’m not certain if my solution is ‘the-right-way’, but for now it works.

  1. onClick -> create a sequence
  2. then 0 -> call all widget class -> actionWidget -> set visibility -> collapse
  3. then 1 -> actionWidget variable -> add to viewport

Now if I click crateB, the widget shown after clicking crateA will be removed/collapsed, then the actionWidget for crateB instance will be called.

You may want to add a simple animation to your widget, for mine - I did slide up to viewport, each time the actionWidget instance added to viewport.

AJ