Get HMDDevice Name: Needs clarification.

I’m using Unreal 4.26
I may be doing something very nooby but how do you even call this function? I have



#include "IXRTrackingSystem.h"
#include "IHeadMountedDisplay.h"
#include "HeadMountedDisplayFunctionLibrary.h"

// Sets default values
APlayerCharacter::APlayerCharacter()
{
    FName deviceA = GEngine->XRSystem->GetSystemName(); // <== this works and compiles
    FName deviceB = GetHMDDeviceName(); // <== GetHMDDeviceName is undefined

    IHeadMountedDisplay* hmd = GEngine->XRSystem->GetHMDDevice();
    FName deviceC = hmd->GetHMDDeviceName() // <== also doesn't work
}


I’ve tried so many imports and different variations and can’t find the proper way to call this

Edit:

I misunderstood where the function GetHMDDeviceName was defined, I looked into HeadMountedDisplayFunctionLibrary and realsied that it was a libarary helper function and not a function on the hmd device so incase anyone else struggled with this the solution is here:



#include "HeadMountedDisplayFunctionLibrary.h"

APlayerCharacter::APlayerCharacter()
{
    FName deviceName = UHeadMountedDisplayFunctionLibrary::GetHMDDeviceName();
}


1 Like