UnityEngine.Network.Destroy C# (CSharp) Method

Destroy() public static method

Destroy the object across the network.

public static Destroy ( GameObject gameObject ) : void
gameObject GameObject
return void
        public static void Destroy(GameObject gameObject)
        {
            if (gameObject != null)
            {
                NetworkView component = gameObject.GetComponent<NetworkView>();
                if (component != null)
                {
                    Destroy(component.viewID);
                }
                else
                {
                    Debug.LogError("Couldn't destroy game object because no network view is attached to it.", gameObject);
                }
            }
        }

Same methods

Network::Destroy ( NetworkViewID viewID ) : void

Usage Example

コード例 #1
0
 /// <summary>
 ///   <para>Destroy the object across the network.</para>
 /// </summary>
 /// <param name="gameObject"></param>
 public static void Destroy(GameObject gameObject)
 {
     if (gameObject != null)
     {
         NetworkView component = gameObject.GetComponent <NetworkView>();
         if (component != null)
         {
             Network.Destroy(component.viewID);
         }
         else
         {
             Debug.LogError("Couldn't destroy game object because no network view is attached to it.", gameObject);
         }
     }
 }
All Usage Examples Of UnityEngine.Network::Destroy