March 2019
Intermediate to advanced
708 pages
17h 9m
English
Just like almost all the other recipes in this chapter, the first thing we need to do is create a game mode as a convenient host for our UI. We create the UI in the same fashion as in the other recipes, that is, by placing Slate code inside the BeginPlay() method of our game mode.
The interesting feature of this recipe concerns how we set the value of our button's label text:
.Text( TAttribute<FText>::Create(TAttribute<FText>::FGetter::Creat eUObject(this, &AAttributeGameMode::GetButtonLabel)))
The preceding syntax is unusually verbose, but what it is actually doing is comparatively simple. We assign something to the Text property, which is of the type FText. We can assign TAttribute<FText> to this property, and the TAttribute ...
Read now
Unlock full access