10 months ago

Finally got the RHI switch working.

Now you can switch between DX11 and DX12 on Windows.

For Linux, Vulkan is the only option.

See article for the code.


You will need to create a new UserWidget C++ class. You will also need a BP user widget as well. In the BP widget, change the parent class to the newly created C++ user widget (whatever name you gave it).

Now you need to write code so open up the C++ widget file. It will open up 2 files; a .cpp file (where you will write function definitions) and a .h file( header, where you will write declarations).

Here's the header file. This is where you will tell the name of the function, it's return type and allow blueprint execution. You can put this under protected.

		
			UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set Current RHI", Keywords = "Graphics API"), Category = Game)
void SetNewRHI(FString SelectedRHI);
		
	
image.png

SelectedRHI is the input that will passed from blueprints.

UFUNCTION is necessary to give certain Unreal arguements like making it exposed to Blueprints.


Here's the function definition in C++. This is where you will tell it what to do when it is called.

		
			
void AConsoleWindow::SetNewRHI(FString SelectedRHI)
{
GConfig->SetString(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("DefaultGraphicsRHI"), *SelectedRHI , GEngineIni);

GConfig->Flush(true, GEngineIni);
}



		
	
image.png

It is basically changing the Engine.ini file to change the default RHI.

Save them both them Compile. You can do this by going to Build then Build Solution in Visual Studio or by pressing the compile button in UE

For UE5, it's down at the bottom right

image.png

For UE4, it's up in the toolbar, right next to the play button

image.png

After successfully compiling, you'll see the function appear in the BP Search Menu

image.png
image.png

Pass through
DefaultGraphicsRHI_DX11 for DirectX11

DefaultGraphicsRHI_DX12 for DirectX12

DefaultGraphicsRHI_Vulkan for Vulkan


Or if you think this is a lot of work then you can use this premade one from Cesio



0 comments

Loading...

Next up

Changed the van's look

I didn't like the previous one that much

Insta Deform Plugin

Don't think I'll end up using it

Now what did @Manic0626 see?

The Cryptmaster Anniversary Update is here! 

@akuparagames saw that players loved the in-universe card minigame "Whatever." So for this update, they've put more effort to make it its own Roguelike game mode!

Try the FREE DEMO: https://bit.ly/CryptmasterSteam

Quests inspired by @WhitethornGames ' Spray Paint Simulator entered your quest log!

Bring color to the world! Restore worn-out surfaces with a fresh coat of paint & watch them come back to life.

Play the free demo to get started: https://bit.ly/spraypaintsimdemo

I'm finally releasing our Final Year Project A Ranger's Journey

It's a somewhat educational game about nature & animals, & it's FREE

Weird Cars

Let Them Come: Onslaught by @Tuataragames has come to Game Jolt!

Celebrate by completing our quests!

Play the FREE demo of Let Them Come: Onslaught on Steam: https://bit.ly/LTCOdemo

Business is Goobin