Changing VR mode to flat mode and back

Good afternoon! Please tell me, how can UE5 implement the ability to switch between VR mode and regular flat mode?

For example, the main game (project) mode is controlled in VR mode using VR controllers and a VR helmet, while the usual flat mode is performed using a keyboard and mouse (observer mode).

What functions and events should be used for this, and where can I read the documentation for implementing this feature?

I figured out how the input systems work individually, but I don’t understand how to combine it.

I don’t quite understand what exactly you have in mind. Do you want to combine VR and desktop mode, or switching back and forth between them?

Look at this:

and “Disable HMD”

However i am unsure if you asked about this, also i am not unsure if this will work during runtime, and not sure if this can just turn this on.off multiple times without crashing etc.

It looks like that stuff is C++ only:

GEngine->XRSystem->EnableStereo(true); // Enable VR
GEngine->XRSystem->EnableStereo(false); // Disable VR

You need something like this:

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyVRManager.generated.h"

UCLASS()
class MyVRManagerProject_API UMyVRManager : public UBlueprintFunctionLibrary
{
    GENERATED_BODY()

public:
    UFUNCTION(BlueprintCallable, Category = "VR")
    static void SetVRMode(bool bEnableVR);
};

and .cpp:

#include "MyVRManager.h"
#include "IXRSystemAssets.h"
#include "IXRTrackingSystem.h"
#include "Engine/Engine.h"

void UMyVRManager::SetVRMode(bool bEnableVR)
{
    if (GEngine && GEngine->XRSystem.IsValid())
    {
        GEngine->XRSystem->EnableStereo(bEnableVR);
    }
}

And watch some tutorial about how to make C++ plugin. Code this in plugin, compile then add to your project. This way you will not change your project to C++.

Or if whole C++ is too complicated, get about 50$ and post on JOBS subforum here, offer that 50$ (its bit low but you should get somebody for it). And yes doing this tiny code, then testing it, then support is about 2 hours, so 50$ is minimal hourly salary.