Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ClientScene

class in UnityEngine.Networking

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Description

A client manager which contains non-instance centrict client information and functions.

This contains static state like tracked local objects and prefab/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 afer a client connection has been set as ready.

Static Variables

localPlayersA list of all players added to the game.
objectsThis is a dictionary of networked objects that have been spawned on the client.
prefabsThis is a dictionary of the prefabs that are registered on the client.
readyReturn true when a client connection has been set as ready.
readyConnectionThe NetworkConnection object that is currently "ready". This is the connection being used connect to the server where objects are spawned from.
spawnableObjectsThis is dictionary of the disabled NetworkIdentity objects in the scene that could be spawned by messages from the server.

Static Functions

AddPlayerThis is the local player ID for the player, for example like which controller a player is using. This is not the global overall player number.
ClearSpawnersThis clears the registered spawn prefabs and spawn handler functions for this client.
ConnectLocalServerCreate and connect a local client instance to the local server.
DestroyAllClientObjectsDestroys all networked objects on the client.
FindLocalObjectThis finds the local NetworkIdentity object with the specified network Id.
ReadySignal that the client connection is ready to enter the game.
RegisterPrefabRegisters a prefab with the UNET spawning system.
RegisterSpawnHandlerThis is an advanced spawning funciotn that registers a custom assetId with the UNET spawning system.
RemovePlayerRemove the specified player ID from the game.
SetLocalObjectNetId is a unique number assigned to all objects with NetworkIdentity components in a game.
UnregisterPrefabRemoves a registered spawn prefab.
UnregisterSpawnHandlerRemoves a registered spawn handler function.