UI scaling is a pretty standard feature of modern games. It lets players change how the size of the UI, and is especially useful for people playing on 4K monitors or TVs far away.

Once you have set up your resolution-independent UI with project-wide DPI scaling rules, it's time to move into C++ to let users modify this scale even further/

MyGameplayStatics.h

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "EngineMinimal.h"
#include "MyGameplayStatics.generated.h"

UCLASS()
class UMyGameplayStatics : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	// Custom UI scale 1.0f == 100%, 2.0f == 200%, 0.5f == 50% etc.
	UFUNCTION( BlueprintCallable, Category = "User Interface" )
	static void SetUIScale( float CustomUIScale );
};

MyGameplayStatics.cpp

#include "MyGameplayStatics.h"
#include "Engine/UserInterfaceSettings.h"

void UMyGameplayStatics::SetUIScale( float CustomUIScale )
{
	UUserInterfaceSettings* UISettings = GetMutableDefault<UUserInterfaceSettings>( UUserInterfaceSettings::StaticClass() );

	if ( UISettings )
	{
		UISettings->ApplicationScale = CustomUIScale;
	}
}

Posted: