Beispiel #1
0
        /// <summary>
        /// Removes the assigned viewID from this NetworkView.
        /// </summary>
        /// <remarks>
        /// Be aware that the viewID is still allocated. The next logical next is usually a call to <see cref="uLink.Network.DeallocateViewID"/>.
        /// </remarks>
        public void SetUnassignedViewID()
        {
            if (_parent.IsNotNullOrUnassigned())
            {
                _parent.SetUnassignedViewID();
                return;
            }

            _network.RemoveNetworkView(this);

            _data.viewID = NetworkViewID.unassigned;
            _data.owner  = NetworkPlayer.server;
            _data.group  = NetworkGroup.unassigned;
            _data.isInstantiatedRemotely = false;

            foreach (var child in _children)
            {
                child._data.viewID = NetworkViewID.unassigned;
                child._data.owner  = NetworkPlayer.server;
                child._data.group  = NetworkGroup.unassigned;
                child._data.isInstantiatedRemotely = false;
            }

            _children = new NetworkViewBase[0];
        }
        internal void _DestroyNetworkView(NetworkViewBase nv)
        {
            OnDestroy(nv);

            nv.SetUnassignedViewID();
        }