Unreal dynamic create UMG
Context¶
this was my reply to this tool
Reply¶
you can create unreal UMG dynamically without c++
in python you can access the widget tree following way
- duplicate your userwidget from the template to make a new userwidget, and pass it to the next method
- load the root node
see unreal.load_object:
first arg is the object’s outer, second arg is the object’s name.
import unreal # given our user widget, we load the widget tree inside, which is a child of the user widget widget_tree  =  unreal.load_object(userwidget, name_of_widgettree) # given the widget_tree, we load the rootnode, which is a child from the widget_tree root_node = unreal.load_object(widget_tree, name_of_rootnode)
- add children to and save the userwidget.
(this only works in unreal 5, not yet got it to work in 4)