im using BergZurgArcade’s guide and there are three errors coming up. im a newb so please help!
-
CS1525: Unexpected symbol ‘:’, expecting ‘)’ or ‘,’
-
CS1519: Unexpected symbol ‘’ in class, struct, or interface member declaration
-
CS8025: Parsing Error
Please help me! would be much appreciated. Just what I need to change thanks! heres the script:
using UnityEngine;
using System.Collections;
public class PlayerHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 200;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI () {
GUI.Box (new Rect(10, 10, Screen.width / 2 / (maxHealth / curHealth), curHealth + "/" + maxHealth);
}
Please Help!!!
You didn’t do something silly, like put all of that in a .js file, did you? It’s C#, it needs to be in a file ending with .cs, not .js. Other than that, I can see that you are missing a curly bracket at the end, but that might just be a copy-paste error.
All of burgzergarcade’s scripts are in c# if I remember correctly, so be sure to create a c# script and name it exactly as the class, PlayerHealth in this case.
you are missing a ) at the end of you gui line so it reads the code wrong easy fix
GUI.Box (new Rect(10, 10, Screen.width / 2 / (maxHealth / curHealth), curHealth + “/” + maxHealth);
ok easy fix. look at the Parentheses you have three left and only 2 right so it reads the code wrong put one more in at the end it should work
GUI.Box (new Rect(10, 10, Screen.width / 2 / (maxHealth / curHealth), curHealth + “/” + maxHealth)); ------ like this-----
YOUR MISSING A } AT THE END!!!