Adding widget in runtime and saving it

I am trying to create a new widget with a click of button and also to save and load the created widget in runtime.
I am able to add widget ( like a list) in a vertical box but i am unable to save and load it.
Any help on the same is appreciated.

You can’t save an instance of a widget itself. You can only save the data that makes the widget. If we had a vertical list full of widgets, you could:

When loading the game:

You may need to save more data then just a class. Look into structs, they will allow you to pack many data types into a single variable. Then you can created arrays of struct and save / load that.

All pseudoscript above.