GUI Null Reference Exception?

Hi, all! I have three GUI Boxes in the OnGUI function. However, whenever I add the third into the code, I get the following error, repeated three times..

NullReferenceException: Object reference not set to an instance of an object Boo.Lang.Runtime.RuntimeServices.CheckNumericPromotion (IConvertible convertible)

What can I do to fix this? My code is as follows.

var skin : GUISkin;
var skin2 : GUISkin;
function OnGUI() {
    GUI.skin = skin;
    GUI.Box (Rect (10,10,Health.health * 3,30), "Health");
    GUI.skin = skin2;
    GUI.Box (Rect (10,40,Health.mana * 3,20), "Mana");
    GUI.skin = skin2;
    GUI.Box (Rect (10, 70,Experience.XP,20),"Experience");
}

Are Experience and XP defined and have a value on startup? Try changing Experience.XP with 50 so you could verify if there's something wrong with that.

Check the following points:

  • Health is not null

  • Experience is not null

  • skin and skin2 are not null