Adding USteamVRChaperoneComponent

in VRPawn.h I included:

#include "Runtime/HeadMountedDisplay/Public/MotionControllerComponent.h"
#include "Runtime/Steam/SteamVR/Source/SteamVR/Classes/SteamVRChaperoneComponent.h"

and declared

UPROPERTY(BlueprintReadOnly, Category = "VRPawn")
USteamVRChaperoneComponent* ChaperoneComponent;

and in the constructor of VRPawn.cpp I am adding the component with DefaultSubobject.

However I get the error “Unrecognized type: USteamVRChaperoneComponent”

What am I doing wrong? I think it might have something to do with the SteamVR plugin and the project.build.cs file, but I can’t figure it out.

Hi,Do you fix the problem ?I get the same error ,I also can’t solve it.

My temporary fix is using Blueprints instead of C++ for the Pawn class. But I will need to use C++ eventually, so I am still looking for a fix.

I solved the problem in my project , I’m not sure if this method is suitable for your project.But I still tell you my method. Here is the step:

  1. In My projectName.build.cs file I do this:
    PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore”,“SteamVR”, “SteamVRController” });
    2.compile myproject.
    3.Then I add the USteamVRChaperoneComponent* ChaperoneComponent in my Pawn.cpp file,and this time I don’t get the error “Unrecognized type: USteamVRChaperoneComponent”.
    Maybe you can try in this way!

oh,I forget one step ,in the pawn.cpp file, you need
#include “SteamVRChaperoneComponent.h”

Thank you!

Big thanks to for the answer:
In the projectName.build.cs file I needed to include the Module Names “SteamVR” and “SteamVRController”. (Private or Public DependencyModuleNames both work and I don’t really know the difference to be honest.) For example:

 PrivateDependencyModuleNames.AddRange(new string[]
        {
            "SteamVR", "SteamVRController", "HeadMountedDisplay"
        });

Also everywhere I am working with a class from those modules, I need to include the .h file. In this case:

#include "SteamVRChaperoneComponent.h"