x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Controlling of widgetvisibility with another widget

Hey guys, I´m trying to make my inventorywidget visible with another widget(the upper left one button) for a mobilegame. I dont know how I can cast from the buttonwidget to the inventorywidget, I tried pretty much and couldnt find something in the internet, I`m pretty sure I just need the target on the cast, then it would work. Thank you for your help :D

alt text

Product Version: UE 4.19
Tags:
casting.png (297.7 kB)
ingame.png (1.2 MB)
more ▼

asked Apr 09 '18 at 03:54 PM in Blueprint Scripting

avatar image

The ATI
1 1

avatar image Aleksandro Apr 09 '18 at 04:10 PM

I think that you just have to add another widget to your viewport on event button clicked. Just make : Event Button Pressed - Create Widget (select your new widget class with your inventory)-take the return pin from that and call -Add to viewport and set Z value greater than the widget you are putting it on like 1 if your first widget‘s Z value is 0. To delete it just call a remove from parent node in your inventory widget when you click the cancel button in the inventory widget.

avatar image The ATI Apr 09 '18 at 04:34 PM

Yeah that was the first thing I tried, but then my Inventorywidget gets reloaded with all the item I collected before destroyed :/ Because I would basically delete everything I saved in the Inventoryvariables/arrays and just load it new the next time I would add it to the viewport, thats why I need to hide it/make it visible with that button, it needs to be active all the time

avatar image Aleksandro Apr 09 '18 at 06:44 PM

Well then why don‘t you combine the widgets into one where your toggle button is placed at your desired location(upper left corner), and the rest- pack it together in one overlay widget component (see left side widgets components.) Them what you do is animate your overlay components alignement or something like that. So: create a new animation „inventoryshow“. Add the Overlay Component and do a timeline where your last location is OUTSIDE OF THE VIEWPORT. On button click it will animate this and the overlay is hidden outside the viewport. Play the animation in reverse after toggling the button and your overlay with all the variables slides in cause you did not destroy your widget. If you have tondestroy it later on better save your variables in game insatnce.

Conclusion: Pack in overlay-create animation-animate outside viewport(and animate in)

avatar image The ATI Apr 09 '18 at 07:22 PM

That is a pretty awesome idea, thank you man :D

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

What you do is, you go the the BP that "creates" the widget and right after you create it store the output as a reference variable. Then when you want to access that widget you cast to the "Creator" widget and grab the reference of the widget from that BP. Below is an example of this:

  1. Player Character BP creates Widget A

  2. Player Character BP stores a reference to Widget A

  3. Widget B would like to modify Widget A's properties but must get a reference to Widget A first

  4. Widget B casts to Player Character (the object pin of Player Character is easy to reference by "get player character")

  5. Once Player Character is available drag off the output pin and ask it to "get" the reference to Widget A

  6. Widget B now has the reference to Widget A through the Player Character

  7. Modify Widget A from within Widget B as you see fit!

Hope this helps!

more ▼

answered Apr 10 '18 at 03:32 AM

avatar image

Nebula Games Inc
5.4k 28 9 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question