In Editor, I add a Camera-Component to my “Pawn blueprint class” . As you can see in image bellow, My component variable name is “ESCamera”.
I would like to find this variable ( Camera-Component ) , and change it’s properties , using codes in C++.
#include "SandBox_01.h"
#include "ESPPawn.h"
AESPPawn::AESPPawn(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
...
void AESPPawn::MoveForward(float FWDValue)
{
if ((Controller != NULL) && (FWDValue != 0.0f))
{
...
// Here I would like to find that component ( using variable name) and modify it's properties ...
}
}
...
Thanks STEIN84 , it works , but more question:
What is the Variable Name in Details menu of camera-component?
Can I use that name to find the component in C++ ?
It is the actual name of the component but I’m not sure you can use it to judge because the component’s display name might include owner actor’s name as it’s prefix.
You don’t need a component’s name to find the right one unless your pawn has multiple CameraComponents (because the function will return only one).