Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Calling RPC with Receivers.All on server does not call it on server #37

Closed
mcguinnessdr opened this issue Jul 26, 2017 · 2 comments
Closed
Labels

Comments

@mcguinnessdr
Copy link
Collaborator

Version Number and Operating System(s)

Latest Develop branch, commit cad82c4
Unity 2017.1.0f3
Windows 10

Expected behavior

RPC should be called on server, as well as clients.

Actual behavior

RPC is only called on clients.

Steps to reproduce

Call networkObject.SendRpc(RPC_NAME, Receivers.All) on server. Clients will receive RPC, but server will not.
You can workaround this by calling if (NetworkManager.Instance.IsServer) networkObject.SendRpc(NetworkManager.Instance.Networker.Me, RPC_NAME);

@mcguinnessdr
Copy link
Collaborator Author

mcguinnessdr commented Aug 1, 2017

I've narrowed this down a bit. I am calling the RPC immediately after instantiating the object, or in networkObject.networkStarted. Calling a non-targeted RPC in either of these places will fail, but calling a targeted RPC will succeed. I'm going to look at how these two cases are handled differently and see if I can find a fix.

Edit: Since I'm targeting the server from the server, it just calls InvokeRpcOnSelfServer, which works as expected, it's actual networked RPCs that aren't being sent, which I believe has been brought up in the past.

@BrentFarris
Copy link
Member

BrentFarris commented Aug 2, 2017

Issue creator has confirmed that this issue is resolved if the RPC is called inside of NetworkStart after creation (which should be intended behavior). This is resolved by issue creators pull request: #46

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants