Get Available Screen Resolutions in Blueprints

From Epic Wiki
Jump to: navigation, search



The following Blueprint Node is based on the function provided by Rama, see Solus Options Menu: Screen Resolutions. The provided function has the limitation that you cannot use it in your own Blueprint Library. The reason is because the FScreenResolutionRHI Type is not a BlueprintType. As I required such a function for my options UMG widget I wrote it, tested it and decided to share it.


The following code is meant to be included in your own Blueprint Library. If you do not know how to make a Blueprint Library I recommend you read Rama's Guide

Header File

First you declare the new FScreenResolutionRHI type. As mentioned in the comments it is not an exact duplicate of FScreenResolutionRHI. The reason is that when I used uint32 I was not able to use break or make nodes. My guess is that the Blueprint's Integer Type is defined as int32 in c++ and thus is not compatible with uint32. If someone can confirm this feel free to do.

 * Screen Resolution
 * @remark Engine type is not meant for blueprints so we replicate the type.
 * @remark The Engine type uses uint32 but we need to use int32. Otherwise it won't be possible to break/make this type.
struct FScreenResolutionRHIBP

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ScreenResolution)
	int32 Width;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ScreenResolution)
	int32 Height;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ScreenResolution)
	int32 RefreshRate;

		Width = Height = RefreshRate = 0;

 * Retrieve a sorted list of all screen resolutions supported by the player's display adapter.
 * @returns the array of all supported screen resolutions.
UFUNCTION(BlueprintPure, Category = Utility)
static TArray<struct FScreenResolutionRHIBP> GetDisplayAdapterScreenResolutions();

Cpp File

#include "RHI.h"


TArray<FScreenResolutionRHIBP> YourBlueprintLibrary::GetDisplayAdapterScreenResolutions()
	TArray<FScreenResolutionRHIBP> ResolutionsToReturn;
	FScreenResolutionArray Resolutions;
	if (RHIGetAvailableResolutions(Resolutions, false))
		// Preallocate just enough memory to store all elements

		for (const FScreenResolutionRHI& EachResolution : Resolutions)
			FScreenResolutionRHIBP resolution;
			resolution.Width = EachResolution.Width;
			resolution.Height = EachResolution.Height;
			resolution.RefreshRate = EachResolution.RefreshRate;


	return ResolutionsToReturn;


--Jtpgames (talk) 13:27, 18 January 2015 (UTC)