[4.17.2] UHeadMountedDisplayFunctionLibrary::ResetOrientationAndPosition() Error

Hi hi
I was created a blank c++ project (TestProject) and created other c++ template project of thirdperson (TempProject)

In TestProject, I create a character c++ (MyCharacter)
In MyCharacter class, I was following the TempProject, the TemplateCharacter class
however the error occur

the problem of the error is the line of code

UHeadMountedDisplayFunctionLibrary::ResetOrientationAndPosition();

may i know why and how to solve it ?
thanks :smiley:

Looks like your code doesn’t know what the function is. You may need to include the header for the code to be found. The documentation for the function can be found here: https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Kismet/UHeadMountedDisplayFunctionLibra-/ResetOrientation-/index.html.

At the bottom, it shows what module and header will be needed - “#include Runtime/Engine/Classes/Kismet/HeadMountedDisplayFunctionLibrary.h”

Thanks
is a mean need to add the whole path ??
cause
the default is:
#include “HeadMountedDisplayFunctionLibrary.h”
however error, I have been try
#include “Kismet/HeadMountedDisplayFunctionLibrary.h”
but is failed as well…
thanks:D, i try

Hi Ka Wai,
Try adding a string “HeadMountedDisplay” to the PublicDependencyModuleNames variable in your [ProjectName].Build.cs file (probably FYP_Game_Development.Build.cs file).

Somewhat like this:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" });

Hope this helps.

1 Like

This was the problem for me. Thanks!

I had this situation today, also in Unreal 4.25. It happens when starting with a blank UE4 project and then adding a First Person or Third Person UE4 Template Pack. On adding the template changes to project files are needed, because a blank UE4 project is missing HeadMountedDisplay.

Solution, adding
, "HeadMountedDisplay"
here in file: [YourProjectName].Build.c

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" });

When landing here after upgrading a project to 5.4(.1)

Add XRBase as module to PublicDependencyModuleNames

2 Likes