Let's incorporate two variables to hold the character's name and the number of starting experience points:
- Add two public variables inside the Character class's curly braces—a string variable for the name, and an integer variable for the experience points.
- Leave the name value empty, but assign the experience points to 0 so that every character starts from the bottom:
public class Character
{
public string name;
public int exp = 0;
}
- Add a debug log in LearningCurve right after the Character instance was initialized. Use it to print out the new character's name and exp variables using dot notation:
Character hero = new Character();
Debug.LogFormat("Hero: {0} - {1} EXP", hero.name, hero.exp);
When hero is initialized, name is assigned a null value that shows up as an empty space in the debug log, ...