How to make saved componets for UMG through C++?
Used this guide to extend UMG to C++
But I can't figure out how to add any components that show up in the blueprint for the UMG widget. I re-parented it to my UUInventoryWidget . How can I have a UScrollbox that when I open it in blueprint before the game launches its exposed there and I am able to move it around and edit it, yet still have control of it in C++? Its not showing up in in UMG.
I did Components.Add(myScrollBox);
How can I get my C++ component to show up in Root-Canvas-mycomponent. So that i can then fill in the rest in UMG but still have it exposed. For C++.
providing as much info on this as you can would help a lot. Thanks!
I have needed to do similar C++ Link to a widget in my own UserWidget class. I didnt try to add it through code however as I would prefer to have the flexibility of changing the layout at any time.
Instead what I do is match the class and/or name of the item in RebuildWidget(). I call super first to make sure all the widgets are made and then match it and use the widget. Here is an example where I just match the class (I made a special menu UMG and Slate class)
What this let me do, is then programatically add menu items to our menu widget here and control all input and functionality in c++. But it also lets us put that widget inside any layout controls like vertical boxes etc in UMG and thus non programmers can just move it around.
Of course I am totally reliant on it being added manually to make it work, but I felt that was ok for the flexibility of layout. On a side note, putting it in RebuildWidget means that code also runs in UMG. So be careful, things like the player owner are not set. The bDesignTime flag is your friend here.
Each UWidget class has a function on it to then get the actual slate widget, so you can then do whatever you want!
Let me know if you need any more info
answered Nov 10 '14 at 06:05 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here