I am currently trying to make a Character selection for a quick demo I’m making within the same level. I’m wondering what would be the best way , to get all of the PlayerControllers and do the SetViewCameraWithBlend() once the game begins. I seem to have encountered a problem setting things in order, since sometimes I do have access to iterators but apperantly the camera needs some more time (.2 is enough) to actually register the camera. I’ve tried storing the NewPlayer variable created in the PostLogin inside an array, so I can call it on the LevelBlueprint->BeginPlay but everytime it runs it only has 1 inside the array, and only does so in the server. I also tried calling a function made in the player controller , from the PostLogin, I’ve tried replicating it, in many ways.
I really want to understand how would one go about or what would be the best way to make a SetViewCameraWithBlend as soon as the game start… and how to make it happen on the client aswell.
Thanks for your time and if theres anything you would like for me to post as far as code, I’ll be happy to!
Cheers ~ Luis
Edit :
So I’ve made a recent change, I created an array of playercontrollers in the level blueprint and made it (ReplicatedUsing), So the array has the right number of players, inside this ReplicatedUsing function - I’ve put :
for (TActorIterator ActorItr(GetWorld()); ActorItr; ++ActorItr)
{
if (ActorItr->GetName().Contains(“SelectClassCamera”))
{
CameraRef = *ActorItr;
for (int32 PlayerControllerCount = 0; PlayerControllerCount < PlayerControllerList.Num(); PlayerControllerCount++)
{
PlayerControllerList[PlayerControllerCount]->SetViewTargetWithBlend(CameraRef, 1, EViewTargetBlendFunction::VTBlend_EaseInOut, 5, false);
}
}
}
but I get a breakpoint, though I don’t know what pointer might be pointing at NULL once the setviewtargetwithblend is called… I’ve checked as much as I can to verify the values but I dont see anything pointing at NULL… Any help is welcome ! Thanks!
Cheers~ Luis
Edit: I have also tried using the GetPlayerControllerIterator() to have access to the player controllers but it’s not doing the SetViewTarget to either of the server or the client, also… I’ve noticed… if I use it through the (NewPlayer) variable in the PostLogin… I atleast have to give a .2 delay for the server to recieve the SetView… I really don’t understand in the order that I would have to setview to both the client and the server without using delays and if its a replicated problem since so far I haven’t seen the client do the same. I usually run it as :
UFUNCTION(Cliente, Reliable)
To make sure it happens on the server’s own client representation and that it happens accordingly on the clients screen.
Any tips are more than welcome!
Cheers~ Luis!
EDIT : Fixed it, apperantly switching the bool in the class defaults in the PlayerController “Auto Manage Active Camera” has given me control over the camera… no delays are needed at all! UFUNCTION(Client, Reliable) should work just fine!