Get Blueprint class from C++
The only problem I have is retrieving the Blueprint Widget class using C++. I can't seem to get it.
It compiles but when running the game: Error in ConstructorHelpers.h on line 157: UE4Editor.exe has triggered a breakpoint.
I tried this instead but it generated more or less the same error:
First of all: Constructhelper's works only if you call them from the constructor itself. Second: you should use fclassfinder but spawn normal uuserwidget then set his class. Here is a link maybe help: https://answers.unrealengine.com/questions/546442/c-reference-to-widget-component-without-editor.html
Third (and this is my suggestion): You can do transparrnt widget classes instead of hardcode everything in constructor. What i mean?
Inherit new widget class from uuserwidget. Add tsubclassof widgetclass in your class.. Make it blueprint editable. Create a new widget in editor. Set your widget class as parent class in class default settings.. from this point you can setup yourwidgetclass variable in editor.
You can freely edit your widget anytime, you will have c++ access for your widget, you can implement any functions into your widget... but design and everything else can be done in widget editor :)
Of course for your class you need use Blueprintclass to edit your widgetclass variable, but that should be not problem unless you do full pure c++ development...
answered Nov 17 '17 at 10:01 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here