This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

I want to ask that if i call an rpc() from a client connected to a server then will it call the remote function on all peers (including server) or in all exept the server?

Does rpc() calls the remote function locally?

in Engine by (942 points)

I'm pretty sure it will call it on the clients and the server.

1 Answer

+3 votes
Best answer

RPC will only call the function locally if you've set it to be that way using rset or the corresponding keywords

RPC will only call the function on peers that have been setup to receive such calls so if your code for the server is the same as the client then yes the server will also run the function

#will be called on all peers that has it
remote func rpc_function():

#will only be called by master peers
puppet func rpc_function():

#will be called on all peers(even server) and locally
remotesync func rpc_function():
by (6,942 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.