The code provided isn’t tested, just used to show an example of what I want to achieve. My mobile game will have a multi-classing aspect and I am just wondering around the best way to select and assign these classes?

public class CharacterClass
{
//Class specific variables here
}

public class PlayerData
{
public CharacterClass primary;
public CharacterClass secondary;
}

public class CreateNewCharacter : MonoBehaviour
 {
public void Create ()
{
PlayerData newPlayer = new PlayerData ();

//Best way to assign these?
//newPlayer.primary =
//newPlayer.secondary =  
}
}

I know I could have UI buttons that each call their own method such as:

public CreateNewBlackMage(CharacterClass class)
{
class = new BlackMage();
}

But this is not how I want to do it (would rather not have to create a method for each individual class for 1 line of code if it can be helped!), but unfortunately I’m struggling to come up with a better way.

Good day.

You can create a Slider for selecting, and one buton to confirm. and just check the slider value to know the selected class