Blueprint Data Types Problem
I've read several posts in Forum and AnswerHub about primitive data type support in Blueprint. One of them is this link:
The problem is, there are some things that even C++ cannot fully control everything in the game and force developers to include Blueprint in it. One such example is controlling and modifying UMG via C++. It is somehow impossible to fully create/construct a Widget (in C++) without any reference to a Widget Blueprint. The constructors force us to have a Widget Blueprint. If I want to have 64-bit data types (int64 or double) in my Widget (in C++), which can be edited anywhere, then it will not be possible because the Widget Blueprint does not support 64-bit data types.
Many sources, I saw, suggest to use Slate framework for C++. But Slate framework is just too complicated. Why not just use simple function calls in ordinary C++ to modify UMG, as it is done in Blueprint? So this condition is extremely annoying.
If UE does not want Blueprint to support 64-bit data types, then at least provide a mechanism in which C++ coders can create/construct anything (such as Widgets) without any reference to a Blueprint. In fact, I just hope that the entire game, no matter how complicated, can be created by using pure C++ and zero Blueprints.
So UE management, please make the right decision because your current decision to exclude 64-bit data types in Blueprint, while forcing developers to always include Blueprint, is terrible. You obstruct the full potential of a game engine. And UE should actually be one of the best ones in the market.
asked Aug 14 '16 at 03:09 AM in C++ Programming
It seems like 64-bit primitive data type support will be ignored for years to come. It's a pity. If UE could support it, then UE will be the best game engine for many years to come.
answered Aug 18 '16 at 01:48 AM
First, this isn't a bug. Adding a native data type to blueprints is way more complicated than typing a single line of code. They kept uint8, float, and int32 from UnrealScript.
Second, UUserWidgets in C++ do not require a widget blueprint at all, allowing you to use any data type. You extend UUserWidget and override NativeConstruct for the constructor. It takes no arguments. From that class you can add all of the widgets such as UButton (UButton::OnClicked.AddDynamic()) and other similar elements. After that you simply add a NewWidget call and pass in your class, then you AddToViewport from your PlayerController.
Don't call something a bug just because you don't know how to use it.
answered Aug 14 '16 at 05:13 AM
For some reason the comment box above isn't taking too kindly to my response.
First you create a widget that extends UUserWidget.
Next you override the NativeConstruct method.
In your .cpp file you implement NativeConstruct.
In your PlayerController class create and display the widget.
Now that you have created your base widget in C++ you can start adding components to it. It is extremely important to note that widget components are also widgets. This means you create them in the exact same way you create your UUserWidget.
In your header file define a widget type. In this case I'll define a UButton.
In your CPP file you will instantiate that button.
There are, of course, more steps in this like setting the padding, color, and other properties. It is best that you give your widgets names so you can find them later using using WidgetTree->FindWidget(TEXT("WIDGET_NAME")).
https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Blueprint/UUserWidget/index.html https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Blueprint/UWidgetTree/index.html https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Components/UButton/index.html
answered Aug 14 '16 at 05:29 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here