Pulling a string from a choice

Basically, when the game starts, it forces the game to use an initial character. Though I have others for choices, they are there specifically for testing. I would like to set it up so that ‘playerName’ will pull from the ‘characterClassName’ so that it names the main character accordingly.

Example:

private string playerName;

        isDartClass = GUILayout.Toggle (isDartClass, "Dart");
        isRoseClass = GUILayout.Toggle (isRoseClass, "Rose");
        isShanaClass = GUILayout.Toggle (isShanaClass, "Shana");
        isLavitzClass = GUILayout.Toggle (isLavitzClass, "Lavitz");

I would like it to pull the name from the quotation marks to have it set the ‘playerName’

You might want to make a ScriptableObject that is your “PlayerTypeChoice” for instance. It would have the player name and any other attributes you want to associate with each player choice.

You can then drag instances of your PlayerTypeChoice asset (which would be separate files in your project) into a public PlayerTypeChoice[ ] variable in your script, and now you are all data driven, the best way to go.

So far each ‘Character’ has it’s own class/stats implemented from their own file. Which also inherits ‘BaseCharacter’ that declares all of their stats, names/descriptions. So it would be best to declare their names in ‘BaseCharacter’ and in their individual files, and then call it within this script?

Iterate through the loaded instances of your class, display them in the UI, and when one is picked, select it off the list.

But that’s the issue. The extra characters are for testing only. To make sure stats and such display properly. Only one will be used as the main character, yet each one will have a specific name to be called as they are introduced later in the game.

This is what I mean:

foreach( var c in MyCharacterList)
{
    c.IsWhatever = GUILayout.Toggle (c.IsWhatever, c.Name);
}

If a single boolean .IsWhatever field doesn’t suffice, then use an array of booleans with predfined indices.