Is it possible to link character skill lists to a GUI, and if so, how?

In our game, characters are able to level up, and when they do they are presented with options of some skills to choose from, but not everyone will end up with the same skills(as the option of which skills you want to learn is different for each character/player). My question is, how could I display a list of the skills they have unlocked with their character on a GUI, so that they are able to see the available skills in combat.

Currently my GUIs are all built through the OnGUI function.

I’m not an experienced programmer, so if you could, please explain simply, or at least in a way that I can further research

I suggest you buy a plugin which named “NGUI”. There are some awesome examples which is like your idea. Talent tree?

// I assumed that you have a interface/abstract class called Skill
// Because you mentioned that not every character has the same skill,
// so I made this assumption that you are taking this approach.
public class Skill {
public string name;

   ...
   ...  
}


public class Example : MonoBehaviour {
   //It doesn't matter as long as it is a collection of skills
   public Skill [] skill;

   //You can either leave it as a function or put it in your OnGUI
   private string[] GetSkillName() {
      string [] str = new string[skill.Length];
      
      for( int i = 0; i < skill.Length; i++ ) {
         str _= skill*.name;*_

}
}

void OnGUI() {

string [] skillName = GetSkillName();

//Display the skills

}
}
This is a very basic solution, much more work are needed if you need more than displaying a list of skill.

So how is it you are storing your skills? In a Dictioary? An Array? What? When the user is presented with the option to level up a skill, what is he doing?

The simplest way to do this is to have a generic skill dictionary or hashtable look up where you save indexes of which skills the player has and then print those indexes out later in the GUI label showing active skills. Or you could just push the skill names to an array if you are really lazy and use .ToString() on the Array.

If you have unique skill objects you can also use dictionary index lookups for them as well instead of having to assign them and call a GetName function as in the other answer.