Mirror
NetworkManager.mode
NetworkClient.active true 客户端连接中/连接后
NetworkClient.isConnected 客户端连接后
NetworkServer.active 自己作为服务端启动后
manager.StartHost(); Server + Client
manager.StartClient();
manager.StartServer();
NetworkBehaviour
NetworkStartPosition
NetworkTransform
NetworkServer.Spawn
NetworkServer.AddPlayerForConnection 服务器把权限给到该客户端
NetworkServer.RemovePlayerForConnection
NetworkServer.Destroy
NetworkServer.Spawn(go, connectionToClient); 授权
identity.AssignClientAuthority(conn);
NetworkClient.Send
NetworkClient.connection.identity
Command—从客户端调用并运行在服务器上 Cmd前缀 检查isLocalPlayer
ClientRpc—在服务器上调用,在客户端上运行,所有观察者都会收到 Rpc前缀 检查isServer
TargetRpc
SyncVars 只能从server改变 同步给client
NetworkClient.connection.Send(Message) //发给指定客户端?
NetworkServer.RegisterHandler<Message>(func)
NetworkClient.RegisterHandler
NetworkServer.SendToAll 发给所有client
NetworkServer.SendToClientOfPlayer 发给指定client
ClientScene.RegisterPrefab 注册prefab
GetComponent<NetworkIdentity>().connectionToClient.Disconnect();
OnStartServer先 OnServerConnect后 OnServerReady再后
OnStartClient先 OnClientConnect后
网友评论