UnityEngine.Networking.NetworkConnection.RemoveOwnedObject C# (CSharp) Method

RemoveOwnedObject() private method

private RemoveOwnedObject ( NetworkIdentity obj ) : void
obj NetworkIdentity
return void
        internal void RemoveOwnedObject(NetworkIdentity obj)
        {
            if (this.m_ClientOwnedObjects != null)
            {
                this.m_ClientOwnedObjects.Remove(obj.netId);
            }
        }

Usage Example

コード例 #1
0
        public bool RemoveClientAuthority(NetworkConnection conn)
        {
            if (!isServer)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("RemoveClientAuthority can only be call on the server for spawned objects.");
                }
                return(false);
            }

            if (connectionToClient != null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("RemoveClientAuthority cannot remove authority for a player object");
                }
                return(false);
            }

            if (m_ClientAuthorityOwner == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("RemoveClientAuthority for " + gameObject + " has no clientAuthority owner.");
                }
                return(false);
            }

            if (m_ClientAuthorityOwner != conn)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("RemoveClientAuthority for " + gameObject + " has different owner.");
                }
                return(false);
            }

            m_ClientAuthorityOwner.RemoveOwnedObject(this);
            m_ClientAuthorityOwner = null;

            // server now has authority (this is only called on server)
            ForceAuthority(true);

            // send msg to that client
            var msg = new ClientAuthorityMessage();

            msg.netId     = netId;
            msg.authority = false;
            conn.Send((short)MsgType.LocalClientAuthority, msg);

            if (clientAuthorityCallback != null)
            {
                clientAuthorityCallback(conn, this, false);
            }
            return(true);
        }
All Usage Examples Of UnityEngine.Networking.NetworkConnection::RemoveOwnedObject