How can I access to a Component in my "Pawn Blueprint class" , using C++?

Hi Guys;

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.

AActor class has functions like GetComponentByClass (reutrns UActorComponent* )

or GetComponentsByClass (returns TArray of owned components of given class - this is a BlueprintCallable func)

You can use these functions with UCameraComponent::StaticClass() argument to get what you need.

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).