How do I call a blueprint widget from C++
I have a HUD coded in C++ and a widget created in BP, how do I use the BP widget in my C++ HUD?
asked Nov 01 '14 at 09:35 PM in C++ Programming
Easiest way (by that i mean without hardcoded refrences to uassets) is to make
exposed blueprint property (Widget Blueprint is subclass of UUserWidget)https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Blueprint/UUserWidget/index.html) in your HUD, it will ofcorse be UClass* type in which you will need to spawn using UWidgetBlueprintLibrary::Create (https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Blueprint/UWidgetBlueprintLibrary/Create/index.htm) and then you can operate it as this function return pointer to it. Create HUD blueprint from you C++ HUD and then you can set any blueprint widget in property you made.
You will also need to extend UUserWidget class to make C++ accessable varables and events so your C++ code can cooperate with Blueprint code
answered Nov 01 '14 at 10:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here