Previous: , Up: Character   [Contents][Index]


5.2 Character Selector

Component: CharacterSelector

NOTE: Character Selector implements character selection using the legacy Unity GUI. Not suitable for mobile.

Provide a list of characters, and send a message to this object when it’s time for character selection (ToggleOn & ToggleOff) to show the menu. This allows the player to switch characters mid-game

Field of CharacterSelector: bool showGUI

Should we show the GUI right now?

Default value: false

Field of CharacterSelector: Rect guiArea

Normalized viewport rectangle indicating the button area. values between 0 and 1

Default value: new Rect(0.3f,0.3f,0.3f,0.3f)

Field of CharacterSelector: bool toggleCursor

Allow this script to control the cursor?

Default value: false

Field of CharacterSelector: bool destroyCamera

Should the camera be destroyed when switching characters?

Default value: true

Optional Field of CharacterSelector: float maxDistance

If greater than 0, close the GUI if the player leaves this radius. Assumes that the player is tagged ’Player’

Default value: 0.0f

Field of CharacterSelector: int windowID

Unique window ID number for this window, must not conflict with any others (change it if it does!)

Default value: 92829

Spawn Settings

Optional Field of CharacterSelector: GameObject spawnPoint

Where do we spawn the new player object?

Field of CharacterSelector: List<GameObject> characters

What characters can we select from?

Available Messages

Message on CharacterSelector: ToggleOn ()

Enables the character selection GUI

Message on CharacterSelector: ToggleOff ()

Disables the character selection GUI

Message on CharacterSelector: Toggle (bool)

Toggles the character selection GUI based on a supplied value

Argument: Should the character selection GUI be shown?

Field of CharacterSelector: bool showGUI

Should we show the GUI right now?

Default value: false

Field of CharacterSelector: Rect guiArea

Normalized viewport rectangle indicating the button area. values between 0 and 1

Default value: new Rect(0.3f,0.3f,0.3f,0.3f)

Field of CharacterSelector: bool toggleCursor

Allow this script to control the cursor?

Default value: false

Field of CharacterSelector: bool destroyCamera

Should the camera be destroyed when switching characters?

Default value: true

Optional Field of CharacterSelector: float maxDistance

If greater than 0, close the GUI if the player leaves this radius. Assumes that the player is tagged ’Player’

Default value: 0.0f

Field of CharacterSelector: int windowID

Unique window ID number for this window, must not conflict with any others (change it if it does!)

Default value: 92829

Spawn Settings

Optional Field of CharacterSelector: GameObject spawnPoint

Where do we spawn the new player object?

Field of CharacterSelector: List<GameObject> characters

What characters can we select from?

Available Messages

Message on CharacterSelector: ToggleOn ()

Enables the character selection GUI

Message on CharacterSelector: ToggleOff ()

Disables the character selection GUI

Message on CharacterSelector: Toggle (bool)

Toggles the character selection GUI based on a supplied value

Argument: Should the character selection GUI be shown?


Previous: , Up: Character   [Contents][Index]