In my player controller’s BeginPlay, I check whether the player may activate any “view targets” by adding:
for (auto iter = GetWorld()->GetAutoActivateCameraIterator(); iter; ++iter)
However, the iterator is always empty for every connected client. The listen server (host) will find the ACameraActor instance. GetAutoActivatePlayerIndex returns the correct index btw. Due to the failure to activate a camera actor, it defaults to the pawn.
I have placed 1 ACameraActor in the level, and set auto activate to player0. Every local player should yield the 0 index.
[HR][/HR]
Iterating by class finds the instances just fine:
for (TActorIterator<ACameraActor> iter(GetWorld()); iter; ++iter)
Here’s the output from the hosting client (listen server):
actor iterator found camera: CameraActor, PlayerIndex: 0, Local=FALSE
actor iterator found camera: CameraActor_0, PlayerIndex: -1, Local=FALSE
actor iterator found camera: CameraActor_1, PlayerIndex: -1, Local=FALSE
GetAutoActivateCameraForPlayer invalid!
And here’s the client’s log (connected client, tested locally):
actor iterator found camera: CameraActor, PlayerIndex: 0, Local=TRUE
actor iterator found camera: CameraActor_0, PlayerIndex: -1, Local=TRUE
actor iterator found camera: CameraActor_1, PlayerIndex: -1, Local=TRUE
GetAutoActivateCameraForPlayer invalid!
The PlayerIndex is retrieved by calling ACameraActor::GetAutoActivatePlayerIndex(), described as:
/** Returns index of the player for whom we auto-activate, or INDEX_NONE (-1) if disabled. */.
[HR][/HR]
I made sure the ACameraActor instance had NetLoad set to TRUE. Though it probably isn’t a replication issue, as the instances are found.
Any suggestion is much appreciated!
PS related post on answer hub https://answers.unrealengine.com/que…cameraact.html