RHIGetAvailableResolutions works in a Packaged Game in c++ but not when used in a BP node via plugin. The BP Plugin version works in Editor builds

Dear Friends at Epic,

The situation here is a little complicated.

I made a node in my VictoryBPLibrary plugin so that people can get a list of available screen resolutions in Blueprints, as this functionality does not seem to be in blueprints.

The BP node works great in pre-shipping builds! Everyone has confirmed that.

But when the game is packaged, even with the appropriate Build CS public dependency additions of RHI and RenderCore, the node does not work!

The game packages just fine, but in both Development and Shipping packaged builds, the node does not work!

#Build CS Clarity

Just to be clear, in my very own project where I had to be able to compile the CPP version, by adding the RHI public dependency, it is this same project that I added the BP plugin version that is not working.

So it is not a Build CS issue, since I compiled both the CPP and the BP plugin and Packaged all using the same Build CS

#CPP and BP Versions Tested About 1 Second Apart, Only 1 Works

I did the following:

I composed a CPP test in a packaged game that activates on key press.

I also included my own blueprint node as part of my plugin, included with the packaged project.

When I press the key to test the BP node, it returns false. As you can see in code below, that means that RHIGetAvailableResolutions itself is returning false!

Then I press the key to run the CPP version, and it WORKS !!

Somehow the BP node usage of RHIGetAvailableResolutions is returning false, while in the same exact test, about 1 second later, then CPP version returns true, and spits out all my computer’s screen resolutions!

How is this possible?

#Repro

If you’d like to test my Plugin version yourself, you can download my plugin here!

The above link is not a direct link, it takes you to my wiki page

#CPP Test

In packaged game, this works perfectly!

void AJoyPCEditor::RamaTests()
{
	FScreenResolutionArray Resolutions;
	if(RHIGetAvailableResolutions(Resolutions, false))
	{
		TArray<FString> Unique;	
		
		for (const FScreenResolutionRHI& EachResolution : Resolutions)
		{
			FString Str = "";
			Str += FString::FromInt(EachResolution.Width);
			Str += " " + FString::FromInt(EachResolution.Height);
			Str += " " + FString::FromInt(EachResolution.RefreshRate);
			
			
			if(Unique.Contains(Str))
			{
				//Skip! This is duplicate!
				continue;
			}
			else
			{
				//Add to Unique List!
				Unique.AddUnique(Str);
			}
			
			//Add to Actual Data Output!
			VShow(Str);
		}
	}
	else
	{
		VShow("RHIGetAvailableResolutions returned false!!!!!!");
	}
}

#BP Node

In Editor Builds, this works perfectly!

In a packaged game it returns false!!!
(tested by me and Midnight on different computers, for both dev and shipping packaged game)

This means that RHIGetAvailableResolutions itself is returning false within the BP node code, for some reason!

bool UVictoryBPFunctionLibrary::OptionsMenu__GetDisplayAdapterScreenResolutions(TArray<int32>& Widths, TArray<int32>& Heights, TArray<int32>& RefreshRates,bool IncludeRefreshRates)
{
	//Clear any Previous
	Widths.Empty();
	Heights.Empty();
	RefreshRates.Empty();
	
	TArray<FString> Unique;	
	
	FScreenResolutionArray Resolutions;
	if(RHIGetAvailableResolutions(Resolutions, false))
	{
		for (const FScreenResolutionRHI& EachResolution : Resolutions)
		{
			FString Str = "";
			Str += FString::FromInt(EachResolution.Width);
			Str += FString::FromInt(EachResolution.Height);
			
			//Include Refresh Rates?
			if(IncludeRefreshRates)
			{
				Str += FString::FromInt(EachResolution.RefreshRate);
			}		
			
			if(Unique.Contains(Str))
			{
				//Skip! This is duplicate!
				continue;
			}
			else
			{
				//Add to Unique List!
				Unique.AddUnique(Str);
			}
			
			//Add to Actual Data Output!
			Widths.Add(			EachResolution.Width);
			Heights.Add(			EachResolution.Height);
			RefreshRates.Add(	EachResolution.RefreshRate);
		}

		return true;
	}
	return false;
}

#The Ultimate Goal

My real goal is to give BP users the ability to get a list of all screen resolutions without having to use CPP / have a c++ programmer on their team!

Any ideas?

And why would RHIGetAvailableResolutions work

  • in BP in Editor Builds
  • In CPP all the time

and not work in a packaged game as a BP node?

#Thanks

Thanks!

This issue isn’t really something that affects me, I am trying to help everyone else with this one.

Rama

Thanks Rama for posting in such detail.

All I can say is my config in which the plugin did not work:

  • 2x GTX570 in SLI 1 monitor active 2
    disabled

  • SLI OFF 3 monitors active (not
    surround)

  • SLI OFF 1 monitor active 2 unplugged

  • NV SURROUND 3 monitors as one

In all the cases the plugin worked when playing in editor !

Same here. Works in editor, but not in packaged standalones.

#Epic?

Any sort of response to this Epic? Working on it? Busy with 4.3? On Vacation? its been 15 days now :slight_smile:

Hi Rama,

I have sent this information to the development team for further investigation. I hope to hear back from someone there soon regarding this issue.

Thanks so much Tim!

#:heart:

Rama

#Epic?

I got Tim’s initial response but I’ve heard nothing since, any update on this?

Why RHI get resolutions is not working when called from BP in a packaged game?

You can use my Victory BP Library to test this!

(39) Rama's Extra Blueprint Nodes for You as a Plugin, No C++ Required! - Blueprint - Unreal Engine Forums!

Let me know!

Rama

or just integrate it. Even in your livestream - YouTube people think this could be useful.

#Resolved

I have tested and in 4.4 this issue has been resolved!

I can now call RHI Get Screen Resolutions in a BP node in a plugin, in 4.4!

It works great!

Thank you Epic!

#:heart:

#Download

Here is the version of my plugin that I tested in a packaged game where it worked great:

August 16th, 15:38AM 2014

Rama

YEEY :smiley: :smiley: :smiley: