Can I use pointers as parameters for Server / Multicast / Client functions?

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!

When possible the engine can match references between games. You should be able to do this and let Unreal’s magic take care of the rest. In general if stuff like this works in PIE, it will work in the packaged build.

Hmm, nice to know that, thank you! This is really helpful.