Question about Leveling System

Ok, I have been following tutorial on leveling system, and I have some errors. Error line 22: Unexpected Symbol ‘}’. Line 34: Parsing Error. Here is script:

using UnityEngine;
using System.Collections;

public class PlayerLevelSystem : MonoBehaviour {

private int curLevel = 1;
private int maxLevel;

private int curExp = 0;
private int maxExp = 100;

// Use this for initialization
void Start ()
{

}

// Update is called once per frame
void Update ()
{
if(curExp >= maxExp)
}
curExp=100;
curLevel++;

}
void OnGUI()
{
GUILayout.BeginArea(new Rect(20,50,40,20), curexp + “/” + maxExp);
GUILayout.BeginArea(new Rect(20,50,40,20), “Level:” + curLevel);
}

Looks like where you have

// Update is called once per frame
void Update () 
{
if(curExp >= maxExp)
}
curExp=100;
curLevel++;

it should be

if(curExp >= maxExp) {

curExp=100;
curLevel++;

}

instead

you also need to remove the } on line 26, and place it at the end of the script, your cutting out

void OnGUI()
{
GUILayout.BeginArea(new Rect(20,50,40,20), curexp + "/" + maxExp);
GUILayout.BeginArea(new Rect(20,50,40,20), "Level:" + curLevel);
}

where you currently have it placed.

so this should work

using UnityEngine;
using System.Collections;

public class PlayerLevelSystem : MonoBehaviour {

private int curLevel = 1;
private int maxLevel;

private int curExp = 0;
private int maxExp = 100;

// Use this for initialization
void Start () 
{

}

// Update is called once per frame
void Update () 
{
if(curExp >= maxExp) {

curExp=100;
curLevel++;

}


}



void OnGUI()
{
GUILayout.BeginArea(new Rect(20,50,40,20), curexp + "/" + maxExp);
GUILayout.BeginArea(new Rect(20,50,40,20), "Level:" + curLevel);
}

}

You bracket is wrong at “if” statement

Ok, the script worked, but it seems to be throwing at me no GUI. The EXP text shows, but no GUI, and level isn’t even there. could you show me what I am doing wrong?

You need to create the graphics for the UI yourself.

You can’t see the the level?

So would I do a GUI.box? or what? Because someone said to use GUILayout.BeginArea. And yes, I cant see the level.

You can have some fun with the GUI in unity, you should check out the reference page here: GUI Scripting Guide

ugh…I need to know whether I need GUI.box or what? Ugh.

You don’t need one, you could use one.

Got it fixed thanks to a friend of mine! And thanks for the help as well!