how do I set up a character selection menu?

I'm trying to set up a character selection menu for my game, so it can have a VS mode where the player and enemy choice will spawn once the match starts. I know I need to use booleans to do it, but my mind is a bit foggy to the rest.

You'll want to set up a class that contains information about both the prefab to spawn and any GUIContent associated with the character. The simplest example would be:

var selectionScreenProfile : GUIContent;
var characterToSpawn : GameObject;

Store a bunch of these in some collection (like an Array).

In your GUI, you'll need to keep track of which player has selected which player, which you can do by keeping an int for each player. So your GUI script may start out something like...

var characterProfiles : CharacterProfile[] //Presuming the script above is named CharacterProfile.js
var numberOfPlayers : int = 1;

private var playerSelections : int[];

function Awake () {
    playerSelections = new int[numberOfPlayers];

I don't know how your character selection screen input is supposed to work, but you simply change the number associated with whichever player selected a character, ie, for player 1:

playerSelections[0] = 5

Assuming player 1 selected the fifth character in `characterProfiles`. In the GUI, you'd draw a box around (or in some other way distinguish) the profile when it's drawn. When you're ready to move on to the actual game stage, you'll need a record of whichever characters the player has selected. So let's add this to the top of the script:

public static var selectedPlayers : CharacterProfile[];

And change Awake to say

function Awake () {
    playerSelections = new int[numberOfPlayers];
    selectedPlayers = new CharacterProfile[numberOfPlayers];

And just before you load the fight scene, record those selections:

for (var i : int = 0; i < numberOfPlayers; i++)
    selectedPlayers _= characterProfiles[playerSelections*];*_
_*<p>When the fightScene loads, have some script get the players and instantiate them (presuming your character selection scene GUI script is CharacterSelection.js:</p>*_
_*function Start ()*_
 _*for (var i : int = 0; i < CharacterSelection.selectedPlayers.length ; i++)*_
 <em>_GameObject.Instantiate (CharacterSelection.selectedPlayers*, spawnPosition, spawnRotation);*_</em>
 <em>_*//Do any other setup associated with player creation.*_</em>

The solution I adopted was to attach objects to the transparent buttons in a scrool rect, so as to manage 3d objects with the convenient of scrool rect interface.

Here you can find the official documentation for use scrool rect: Redirect to... title of new-page

Maybe my assets can serve you :wink: