- Home /
RPCMode.AllBuffered Basic Question
The documentation seems to be pretty concise on the way AllBuffered is being sent.
Basically, I have a build where a player hosts a game and plays at the same time(Listen server http://en.wikipedia.org/wiki/Game_server#Listen_server). When a RPC is sent with RPCMode.AllBuffered does it get sent to the hosting computer twice since they are both a client and the server?
My RPC has currently been executing twice on the host and trying to isolate if it is a bug in another part of my code :) If it does get executed twice, is there a good way to handle this?
Answer by thegreatzebadiah · Jan 08, 2015 at 07:19 AM
RPCMode.AllBuffered
will not send two messages to the host just because they are also playing the game. That's assuming that you have your networking set up correctly though. Your server should be calling Network.InitializeServer
and your clients should be calling Network.Connect
. Nothing else should be necessary to get the host and all clients in a game together. The server does not need to Network.Connect
to itself.
I have all the methods for setting up the server. I have had it previously working. $$anonymous$$y Network.InitializeServer works fine and provides a debug statement of the method being called. The strange part I noticed in my recent build is that the $$anonymous$$asterServerEvent "RegistrationSucceeded" gets called twice. The rpc gets sent once but still is executed twice on the host. I'll double check my other methods as it may be there.
After having a friend look at my scene, I realized the two calls were because my script was running on two gameobjects.. Sad day, realizing my dumb mistake. Thank you for clarifying the RPC$$anonymous$$ode because it led me find the issue!