Let’s say I want one player to turn to the second player when the second player initiates it, and my first obvious solution is to send the character reference as a parameter:
void MyCharacterClass::Server_SetTarget_Implementation(AActor* InCharacter, AActor* LookTarget)
{
InCharacter->Client_SetTarget(AActor* LookTarget);
}
void MyCharacterClass::Client_SetTarget_Implementation(AActor* LookTarget)
{
Target = LookTarget;
// Some other code
}
It works fine locally (with several players set in PIE), but is it okay to do so and will it work in an actual multiplayer game? Or should I, for example, assign indices to all players, and use int32 parameters instead of AActor pointers? What’s the best practice?
Thank you in advance!