1. Window/full screen switching
1. Switch between windowed and full-screen blueprints:
In addition, you can read the last setting information when entering the system.
2. C++ switch windowed and full-screen:
First create the C++ class of the blueprint function library, then paste the .h and .cpp codes, and click Regenerate in VS.
(1) Windowing
.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Engine/GameEngine.h"
#include "EngineGlobals.h"
#include "MinimizeWindow.generated.h"
/**
*
*/
UCLASS()
class BEIDOU_API UMinimizeWindow : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
static bool SetWindow_Minimize();
};
.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MinimizeWindow.h"
bool UMinimizeWindow::SetWindow_Minimize()
{
UGameEngine* gameEngine = Cast<UGameEngine>(GEngine);
if (gameEngine)
{
TSharedPtr<SWindow> windowPtr = gameEngine->GameViewportWindow.Pin();
SWindow* window = windowPtr.Get();
if (window)
{
window->Minimize();
return true;
}
}
return false;
}
(2) Full screen
.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Engine/GameEngine.h"
#include "EngineGlobals.h"
#include "MaximizeWindow.generated.h"
/**
*
*/
UCLASS()
class BEIDOU_API UMaximizeWindow : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
static bool SetWindow_Maximize();
};
.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MaximizeWindow.h"
bool UMaximizeWindow::SetWindow_Maximize()
{
UGameEngine* gameEngine = Cast<UGameEngine>(GEngine);
if (gameEngine)
{
TSharedPtr<SWindow> windowPtr = gameEngine->GameViewportWindow.Pin();
SWindow* window = windowPtr.Get();
if (window)
{
window->Maximize();
return true;
}
}
return false;
}
2. Resolution setting
1. The blueprint implements the resolution setting by executing the console command:
r.setRes 960*720w
Console command description:
windowed w
full screen f
resolution 960*720
(It can be changed to other resolutions, but it will be automatically ignored if the resolution exceeds the supported range. What the supported range includes can be viewed in UE5.)
3. Rendering settings (shadows, anti-aliasing, post-processing, image quality, deferred lighting, texture quality)
As above, the blueprint implements rendering settings by executing console commands. The specific commands are as follows:
(Add 1 after the command to turn on and 0 to turn off)
(1) Shadow:
sg.ShadowQuality 0
Adjust shadow quality. After closing, the screen becomes brighter and the consumption becomes lower.
(2) Anti-aliasing:
r.PostProcessAAQuality 0
Toggles various anti-aliasing (TemporalAA and FXAA, etc.).
(3) Post-processing:
sg.PostProcessQuality 0
Turn on/off post filter.
(4) Screen rendering image quality:
r.ScreenPercentage 35
Used to reduce the actual rendering resolution internally.
(5) Turn on/off delayed lighting
r.TiledDeferredShading 0
Tile-based deferred lighting technology can be turned off (there is no fallback method for GPU particle light and shadow), and the lighting effect will decrease after turning off.
(6) Texture quality:
sg.TextureQuality 3
Used to toggle texture quality.
See:
(1) Other commands refer to 1
(2) Other commands refer to 2
4. Volume settings
(1) Generate a sound object according to the content and play it.
(2) The Volume function is executed when the sound is played.
(3) The Volume function calls the SetVolume function
(4) The SetVolume function obtains the slider value to change the volume.