Here is how I would do it. I'm assuming you know how to get the appropriate references between scripts and declare variables and all that stuff. I'm also assuming you have appropriate code to load the player. The code just covers the GUI. This method is almost independent of the number of classes you have.
void OnGUI () {
foreach (RPGClass currentClass in rpgclasses){
// You could also add other GUI stuff in here
if(GUILayout.Button (currentClass.ClassName){
// Create your player as required here
}
}
}
↧