I’m currently stuck trying to understand how replication works when it comes to actor ownership.
In my game, I have a player who possesses a pawn. The pawn can spawn an actor (a robot humanoid character) and take movement control of it while still possessing the main pawn. In other words, the player doesn’t possess the spawned actor, but he can control it’s movement while still walking around as the pawn.
This works fine in single player, but when it comes to multiplayer I get stuck.
In the blueprint below, the top green section is located in the pawn (PlayerCamera).
The player presses P to spawn the robot character.
The middle yellowish blueprint is located in the player controller (GameplayPC).
The controller spawns the robot (IceMan) and sends the character’s reference back to the pawn (as ‘ControlledUnit’).
The bottom green blueprint is in the pawn and shows part of movement control.
This works fine when playing as the server, but fails as a client. The client can spawn the character (and is replicated properly from other clients/server), but cannot control it.
From what I can gather, the pawn never receives the reference to the spawned character so cannot control it. I don’t understand why the character reference isn’t sent back to the pawn client-side.
It would be great if somebody could help me solve this. More importantly, I want to learn why this doesn’t work.
Alternatively, if somebody has a better way of achieving this goal (pawn being able to spawn a character without changing possession), I would love to hear how it could be achieved.
Thanks in advance for any help.