How can I essentially do “create widget”->”add to viewport” inside of a c++ implementation file? I can’t find ANYTHING to explain how to do this, but I was told that it was possible.
Additionally, how can I play an animation in c++?
I want to create an error message that fades in and out and I’ve already created the widget and the animation for it. I just need to do it at the fight point in a cpp file.
Thanks in advance!
1 Like
QUANDINI
(QUANDINI)
May 16, 2020, 7:15am
2
this video should help. its what I followed when I had the same issue, hope this helps!
Wow, that’s exactly what I was looking for. Thank you so much!
nande
(nande)
November 16, 2022, 8:55pm
5
the answer without having to watch videos
You cretare UClass* varable WidgetClass but you never set it, when it reach CreateWidget WidgetClass is still not set, function don’t know which widget you want to make, the class in template i just for auto casting and it ignored in widget spawning if you put class argument. So function fails to create widget as result WidgetClass is null and when you call your function you calling it on null pointer, which means immediate crash. So replace:
TSubclassOf<class UUserWidget> WidgetClass;
UErrorWi…
this post also contains lots of useful info (a bit old but still useful)
I have read several links regarding creation of widgets in C++. One of them is this:
Unfortunately that was in 2014. It’s 2 years from then. So I assume, UE is much better and support many more libraries. So with UI 4.12.5, is it really possible to fully create a simple widget with a simple UTextBlock in it and display a text on screen?
Remember, my question is to do that in pure C++. No blueprint widget or any reference to blueprint widget is allowed in here. If you can answer it, please pr…