Why my camera isnt been placed where i coded?

Hi guys, i am a bit confused at this stage. i am trying to do simple stuff. in this case spawn ACamereaActor in some
location i said, fixed. Then using APlayerController, look at my player. (Arkanoid game).
i tried A LOT of codes, searched Google, and the forum and called Mister unreal Engine Junior, but i cant figure out how to do it. The camera simply stays at (0,0,0), no matter what, and i know its becouse of his mobility, but i tried to configure the mobility almost in every place reasonable. Here is my code , sorry the mess :frowning: i am a bit tired.

A- i dont know how to spawn my custom “AMyCustomPlayerController”, i saw no example or Doc about it :frowning: . i just spawn the default PlayerController.
B- i dont know how to fix the problem of not being able to set the location of my camera.
C- i dont know how to say to the default PlayerController to use ACameraComponent, it simply doesnt wanna work(check the code).
5Hs+ working on this, i quit, till tomorrow. :smiley:
i checked a lot of possible solutions to those 3 questions but i couldnt fix one.

void AMyGameMode::StartPlay()

APlayerController* playerController = UGameplayStatics::GetPlayerController(this, 0);
playerController->bAutoManageActiveCameraTarget = false;
UWorld* const World = GetWorld();
if (World){
	ACameraActor* camaraPrincipal = World->SpawnActor<ACameraActor>(GetClass(), FVector(-90.0f, 20.0f, 170.0f), FRotator());
	camaraPrincipal->SetActorLocation(FVector(-90.0f, 20.0f, 170.0f), false);	

if (GEngine)
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("HELLO WORLD"));


PD: i have no compile errors nor nothing similar. i add code and then i check if it works.

It may be that the camera actor part is working fine, but the playercontroller is resetting the viewtarget to something else after your code is called. I’d try having a look in the editor during the game to see where the camera actor is as a first step. I’d also try calling that code somewhere else, rather than from AMyGameMode::StartPlay(). Try calling it from the playercontroller and see if that helps.

Also try putting:

 PlayerController->bAutoManageActiveCameraTarget = false;

After you set the viewtarget to stop it being reset.