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.