Next: , Previous: , Up: Network   [Contents][Index]


13.2 Photon Avatar Handler

Component: PhotonAvatarHandler

Allows selection of an avatar prefab by the player. When spawning players using this, their current avatar will despawn. Great for instant respawn games. —Messages— ’SetAvatarString’ takes a string parameter representing the name of the new prefab you want to use for this player. Prefab must be directly inside a ’Resources’ folder.’Spawn’ takes no parameter. It will first destroy the player’s current avatar, if any, then will instantiate a new one using the string assigned as the avatar. Make sure to call ’SetAvatarString’ before spawning or you will get an error.

Field of PhotonAvatarHandler: bool destroyOldPlayer

Should we destroy the old player, if it still exists?

Default value: true

Message on PhotonAvatarHandler: SetAvatarString (string)

Sets the Resource name of the Player avatar object we want to spawn, change this to change the player prefab.

Argument: Name of the new Player prefab

Message on PhotonAvatarHandler: Spawn ()

Spawns the Player’s Avatar immediately.

Field of PhotonAvatarHandler: bool destroyOldPlayer

Should we destroy the old player, if it still exists?

Default value: true

Message on PhotonAvatarHandler: SetAvatarString (string)

Sets the Resource name of the Player avatar object we want to spawn, change this to change the player prefab.

Argument: Name of the new Player prefab

Message on PhotonAvatarHandler: Spawn ()

Spawns the Player’s Avatar immediately.