Function call originated from remote or local source

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CustomUser

How do I tell if a function call originated from a local method or remote call?

I have a remote function that I want to call from both sources and execute a different code branch accordingly. Current solution is to have another variable to declare if the call is local when making the call, but it doesn’t translate well if I use remotesync function.

:bust_in_silhouette: Reply From: klaas

this functions of the multiplayer api should help

get_network_unique_id ( ) 
get_rpc_sender_id ( )  

the documentation states:

Returns the sender’s peer ID for the RPC currently being executed.
Note: If not inside an RPC this method will return 0.

But i dont know if it return 0 when its an remotesync but called localy … if not you can compare the sender id to the network unique id