Search Unity

RPCMode.Others in Unet

Discussion in 'UNet' started by JoeTheGG, Jun 22, 2016.

  1. JoeTheGG

    JoeTheGG

    Joined:
    Aug 18, 2013
    Posts:
    42
    Hi everyone,
    First of all let me say I am quite enjoying UNet with it's ease of use and functionality. Coming from both the Legacy systems and Photon, UNet is a breeze to setup and get working.

    However I have come across a problem specifically with sending out RPC's. With the legacy system you used can send RPC's to everyone else with RPCMode.Others. Likewise you could do that in Photon with PhotonTargets.Others.

    My questions is if there is a simple way that I can send RPC's out all to clients except myself? I am super new to UNet, and I am really hoping that it is something similarly easy I have just overlooked it...

    Thanks for your help!

    -Swirllyman
     
    MendyBerger likes this.
  2. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    I think it was mentioned that this was going to be built in at some point, but for now it's pretty simple to work around:
    1. Owner sends a CmdWhatever() to the Server
    2. Server sends RpcWhatever() back out to all the clients
    3. Each client checks if (!hasAuthority) in the RpcWhatever() method
     
  3. JoeTheGG

    JoeTheGG

    Joined:
    Aug 18, 2013
    Posts:
    42
    Thanks for the response, I ended up using (!isLocalPlayer) in the RPC method. That seemed to work as well.
     
    MendyBerger likes this.
  4. Jacob_Brothers

    Jacob_Brothers

    Joined:
    Oct 26, 2019
    Posts:
    1
    It's worth noting that, using this method, you still send out the RPC to yourself, the method just wouldn't run. If you are looking to send out an RPC to everyone except yourself, this will not work. If you are looking to update everyone on something except yourself, this will work.