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"

How do I save data inside UMG widgets that have been instanced/generated?

(This can apply to all engine versions using UMG)

Hey guys and girls,

I've created a widget that is to be used inside a Grid Panel in UMG. So far I have buttons that add this widget to the grid panel during runtgime. Adding the widget is fine and all the data works perfectly as I had designed it (woo!).

Here is a screenshot of what the screen looks like when I have added a couple of CF (Conventional forces) and Mechs:

alt text

Here is the logic in the RosterScreen:

alt text

And here is the Mech Widget's logic since you can customise the stats (which works, i just need to sort out my default combo box option).

alt text

I know how to save variables to a slot but my problem is I can't seem to get my head around saving the data of multiple instances of this widget in the Grid Panel.

The Mech and CF widget is instanced and added to the grid panel everytime the +Mech or +CF button is pressed. The data can be independently edited too. It's just saving all of that which is boggling me.

I would like the player to be able to save the data in each of the instanced/newly generated widgets they add to the Grid Panel and be able to load the last sessions generated widgets including all the data inside those generated widgets.

I'm pretty sure it's possible and it's frustrating me to no end on how i can get this working. Anyone able to give me a few pointers?

EDIT: I've tried adding widgets to an array and recording their index number. I then copied the way i generated the widgets and tried to save the array and then load the array data whilst using a WhileLoop to add the widgets back in. This didn't succeed...if that method is a legit answer then I most likely went about it the wrong way....so yeah...I'm still stuck!

Here's a video of the roster in action as well. YouTube

Product Version: UE 4.11 Preview
rosterscreenbp.png (189.4 kB)
rosterscreen.png (44.5 kB)
more ▼

asked Mar 14 '16 at 10:58 AM in Blueprint Scripting

avatar image

173 37 33 44

avatar image Kagamusha Mar 16 '16 at 02:06 PM

Would saving the data in each of the widgets to a struct and then saving the index and struct work? Just experimenting with it now and I can Set Members of Struct and i believe i can drag the return node off to even add it to an array?

avatar image Kagamusha Mar 21 '16 at 11:55 AM

I've managed to get as far as generated the widgets from loading from slot. Everytime a widget was added I added 1 to a variable and saved it. Then I pretty much used the same method for manually generating widgets apart from I made an event that used my widget counter variable and it load however many widgets of that type that were recorded.

Screenshots will be posted soon.

I still have the issue of saving data inside those widgets though.

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

0 answers: sort voted first
Be the first one to answer this question
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