- Home /
Unexpected symbol GUI
Thats is my code but o think all is right but console writing me "Unexpected symbol GUI" Thanks for all using UnityEngine; using System.Collections;
public class Gracz : MonoBehaviour { public int MaxHP; public int HP; public int Glod; public int Woda; public int Sen; public GUISkin skinHP; // Use this for initialization void Start () { MaxHP = 100; HP = MaxHP; Glod = 100; Sen = 100; Woda = 100; }
// Update is called once per frame
void Update () {
}
void OnGUI()
{
GUI.skin = skinHP;
GUI.Box (new Rect (10, 10, 200, 50), "Zycie: " + HP);
}
}
This is a bad question and can't be answered because:
Code formatting is missing so it's extremely hard to read the code. Please read through the UserGuide and then **edit** your question.
Since you got an error you should include the exact error message with filename, linenumber and maybe mark the line that is reported in some way. You can select the error text in the bottom half of the console window and copy & paste it.
If the question is not improved we will close the question.
Answer by Xarbrough · Dec 19, 2015 at 05:15 PM
Your code works in my scene, so it must be something else. Create a new scene and put your script on a new object without anything else and test again; should work. You don't have to set default value in Start(), you can do it after the variable declaration as well.