SceneCaptureCube in c++

I’m new to ue4 so apologize if this is a dumb question. I was able to get a SceneCaptureCube working using Blueprint, but now I’m trying to put one into my c++ code and I can’t figure out how to do it. Can someone show me a c++ code sample of how to add a SceneCaptureCube as a subobject and how to use it to update the texture of a material and apply to another object.

Thats how i tried it. Whats not working is the Texturetarget. I get a Errormessage regarding the Object finder. But I don’t have any clue what went wrong. … :confused:


AMyProjectPawn(const FObjectInitializer& ObjectInitializer);
/** SceneCapture Cube /
UPROPERTY(Category = Scenecapture, VisibleDefaultsOnly, BlueprintReadWrite, meta = (AllowPrivateAccess = “true”))


//Setup SceneCapturecube
static ConstructorHelpers::FObjectFinder Targettex(TEXT(“/Game/VehicleAdv/Materials/ReflectionsCapture.ReflectionsCapture”));
Capturecube = CreateDefaultSubobject(TEXT(“CaptureCube”));
Capturecube->SetRelativeLocation(FVector(0, 0, 160));
Capturecube->TextureTarget = Targettex.Object;

if you comment out the Constructorhelper and the Texturetarget part… you get a Texturecube where you can ad a target in the editor… At least for positioning and testing purposes it works fine for me.