PhotonNetwork.RemoveAllInstantiatedObjects C# (CSharp) Method

RemoveAllInstantiatedObjects() public static method

MasterClient method only: Destroy ALL instantiated GameObjects
public static RemoveAllInstantiatedObjects ( ) : void
return void
    public static void RemoveAllInstantiatedObjects()
    {
        if (isMasterClient)
        {
            networkingPeer.RemoveAllInstantiatedObjects();
        }
        else
        {
            Debug.LogError("Couldn't call RemoveAllInstantiatedObjects as only the master client is allowed to call this.");
        }
    }

Same methods

PhotonNetwork::RemoveAllInstantiatedObjects ( PhotonPlayer targetPlayer ) : void

Usage Example

Ejemplo n.º 1
0
 public void StartGame()
 {
     Debug.Log("StartGame");
     if (PhotonNetwork.isMasterClient)
     {
         PhotonNetwork.RemoveAllInstantiatedObjects();
     }
     ResetGameTime = float.MaxValue;
     GameStarted   = true;
     foreach (Transform a in Fx)
     {
         Destroy(a.gameObject);
     }
     if (pv.team != Team.Spectators)
     {
         Debug.Log("Creating Self " + pv.team);
         InstanciateShared(NetworkPlayerID, PlayerPrefab);
     }
     _ObsCamera.audio.PlayOneShot(go.Random());
     if (PhotonNetwork.isMasterClient)
     {
         foreach (var a in playerViews)
         {
             if (a.Value != null && a.Value.bot)
             {
                 InstanciateShared(a.Key, GetPrefab(a.Value.plType));
             }
         }
     }
 }