Switching camera components using C++

I have two camera components on my C++ Actor blueprint.

For now, my C++ code uses a camera interface actor to switch from two editor cameras to the player camera, which is defaulting to the shoulder cam. Each camera is bound to a separate key right now.

259042-help2.png

This works great and I just need to know from this point, how I could make it so if I press the character camera key a second time, it switches between the two camera components (FPS and Shoulder) I have.

Hi FluffyGryphon,

Something like this should be enough for you to switch between cameras:

if (NewViewMode == EViewMode::ThirdPerson)
{
	ThirdPersonCamera->SetActive(true);
	FirstPersonCamera->SetActive(false);
}
else // if (NewViewMode == EViewMode::FirstPerson)
{
	ThirdPersonCamera->SetActive(false);
	FirstPersonCamera->SetActive(true);
}

Thank you! I’ll give that a shot.