PhotonNetwork.SendOutgoingCommands C# (CSharp) Method

SendOutgoingCommands() public static method

Can be used to immediately send the RPCs and Instantiates just made, so they are on their way to the other players.
This could be useful if you do a RPC to load a level and then load it yourself. While loading, no RPCs are sent to others, so this would delay the "load" RPC. You can send the RPC to "others", use this method, disable the message queue (by isMessageQueueRunning) and then load.
public static SendOutgoingCommands ( ) : void
return void
    public static void SendOutgoingCommands()
    {
        if (!VerifyCanUseNetwork())
        {
            return;
        }

        while (networkingPeer.SendOutgoingCommands())
        {
        }
    }

Usage Example

Ejemplo n.º 1
0
 private void OnApplicationFocus(bool focus)
 {
     playerState = focus;
     if (!isOnlineMode)
     {
         return;
     }
     if (focus)
     {
         Debug.Log("Application resume");
         if (opponentState)
         {
             Time.timeScale = 1f;
         }
         WhotUiManager.instance.connecting.SetActive(true);
         StartCoroutine(checkPoolStatus());
         if (PhotonNetwork.room != null)
         {
             WhotUiManager.instance.connecting.SetActive(false);
             PhotonNetwork.RaiseEvent(152, 1, true, null);
             PhotonNetwork.SendOutgoingCommands();
         }
     }
     else
     {
         // playerState = false;
         Debug.Log("Application pause");
         WhotUiManager.instance.connecting.SetActive(true);
         Time.timeScale = 0f;
         PhotonNetwork.RaiseEvent(151, 1, true, null);
         PhotonNetwork.SendOutgoingCommands();
     }
 }
All Usage Examples Of PhotonNetwork::SendOutgoingCommands