A client manager which contains static client information and functions.
This manager contains references to tracked static local objects such as spawner registrations. It also has the default message handlers used by clients when they registered none themselves. The manager handles adding/removing player objects to the game after a client connection has been set as ready.
The ClientScene is a singleton, and it has static convenience methods such as ClientScene.Ready().
The ClientScene is used by the NetworkManager, but it can be used by itself.
As the ClientScene manages player objects on the client, it is where clients request to add players. The NetworkManager does this via the ClientScene automatically when auto-add-players is set, but it can be done through code using the function ClientScene.AddPlayer(). This sends an AddPlayer message to the server and will cause a player object to be created for this client.
Like NetworkServer, the ClientScene understands the concept of the local client. The function ClientScene.ConnectLocalServer() is used to become a host by starting a local client (when a server is already running).
localPlayers | ゲームに追加されているすべてのプレイヤーのリスト |
objects | これは、クライアント上で生成されたネットワーク関連のオブジェクトの dictionary です。 |
prefabs | This is a dictionary of the prefabs that are registered on the client with ClientScene.RegisterPrefab(). |
ready | Returns true when a client's connection has been set to ready. |
readyConnection | The NetworkConnection object that is currently "ready". This is the connection to the server where objects are spawned from. |
reconnectId | The reconnectId to use when a client reconnects to the new host of a game after the old host was lost. |
ReconnectIdHost | A constant ID used by the old host when it reconnects to the new host. |
ReconnectIdInvalid | An invalid reconnect Id. |
spawnableObjects | サーバーからのメッセージによるオブジェクト生成を行った、シーン内にある無効状態となっている NetworkIdentity オブジェクトの Dictionary です。 |
AddPlayer | This adds a player GameObject for this client. This causes an AddPlayer message to be sent to the server, and NetworkManager.OnServerAddPlayer is called. If an extra message was passed to AddPlayer, then OnServerAddPlayer will be called with a NetworkReader that contains the contents of the message. |
ClearSpawners | オブジェクトを生成するために登録されているプレハブと、クライアント側のオブジェクト生成ハンドラーをクリアします。 |
ConnectLocalServer | Create and connect a local client instance to the local server. This makes the client into a "host" - a client and server in the same process. |
DestroyAllClientObjects | クライアント上にあるネットワーク関連すべてのオブジェクトを削除します。 |
FindLocalObject | 特定のネットワーク ID を持つローカルの NetworkIdentity オブジェクトを探します。 |
Ready | 接続しているクライアントがゲーム可能かどうかを判断します。 |
RegisterPrefab | UNET のオブジェクト生成システムにプレハブを登録します。 |
RegisterSpawnHandler | This is an advanced spawning function that registers a custom assetId with the UNET spawning system. |
RemovePlayer | Removes the specified player ID from the game. |
SendReconnectMessage | Send a reconnect message to the new host, used during host migration. |
SetLocalObject | ネットワーク ID は、ゲームにある すべてのNetworkIdentity コンポーネントにユニークな数値として割り当てられています。 |
SetReconnectId | Sets the Id that the ClientScene will use when reconnecting to a new host after host migration. |
UnregisterPrefab | Removes a registered spawn prefab that was setup with ClientScene.RegisterPrefab. |
UnregisterSpawnHandler | Removes a registered spawn handler function that was registered with ClientScene.RegisterHandler(). |