An alternative solution could just be to have another text box on top of your current one, with its font already set to the size you want, and you just hide the smaller text and show the bigger text (Set Visibility) once your player has entered the password.
"IF" the text youâll change the font for is a TextBlock youâll need to create a new CustomTextBlock class (on C++) in such way you could access/change the Font variable after the widget get constructed, because until 4.6 itâs not exposed on post default editing situations.
If you get interested, go to âAdd Code To Projectâ, pick the âUTextBlockâ as base class and give a name as âTextBlockPlusâ, when the engine offer to you the option to edit the class, accept.
on the .h file make something as this:
#pragma once
#include "Components/TextBlock.h"
#include "Runtime/SlateCore/Public/Fonts/SlateFontInfo.h"
#include "TextBlockPlus.generated.h"
/**
*
*/
UCLASS(BlueprintType)
class UTextBlockPlus : public UTextBlock
{
GENERATED_BODY()
public:
UTextBlockPlus(const FObjectInitializer&);
UFUNCTION(BlueprintCallable, Category = "Customization")
void SetANewFont(FSlateFontInfo NewFontInfo);
};
after, make the .cpp as this:
#include "TextBlockPlus.h"
UTextBlockPlus::UTextBlockPlus(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
void UTextBlockPlus::SetANewFont(FSlateFontInfo NewFontInfo)
{
Font = NewFontInfo;
SynchronizeProperties();
}
Compile, go back to the editorâŚ
If you replace your Standard TextBlocks on your widgets by your new TextBlockPlus theyâll have now a new Function that will allow you to change font and size at your will.
The way I went about this is using âSet Render Scaleâ. A pretty simple function call. I would suggest it so you can get a smooth scale and no snapping to the next size.
Iâm in 4.7.3 at the moment, and this doesnât seem to be possible. Have you figured out a solution for setting font point sizes dynamically (without using C++)?
Iâm pretty sure that this is an issue with structs. Structs in blueprints are very buggy. In 4.8 structs are fixed. Before 4.8 the only way Iâve found to work when you try to change something in it is call âMake Structâ to create a new one with all of the info it needs, and then set your data to that struct. However you canât call SetFont on the text block in blueprints. Iâm not sure about C++ code however.
Thanks MuzzyA this is a good workaround for now, though it would be good if we could change the size of text properly (to avoid blurring from being scaled). Doesnât seem like itâs an animatable property (Iâd like to âpulseâ the playerâs score whenever points get added or deducted - a fairly common thing to do).