private static NetworkView Require(Object obj)
        {
            NetworkView nv = null;

            if (obj is NetworkView)
            {
                nv = obj as NetworkView;
            }
            else if (obj is Component)
            {
                nv = (obj as Component).GetComponent <NetworkView>();
            }
            else if (obj is GameObject)
            {
                nv = (obj as GameObject).GetComponent <NetworkView>();
            }
            else if (obj.IsNullOrDestroyed())
            {
                throw new ArgumentNullException("obj");
            }

            if (nv.IsNullOrDestroyed())
            {
                throw new ArgumentException("Missing NetworkView", "obj");
            }

            return(nv);
        }
Exemple #2
0
        public bool Destroy(GameObject gameObject)
        {
            NetworkView nv = NetworkView.Get(gameObject);

            return(!nv.IsNullOrDestroyed() && Destroy(nv));
        }