- Home /
The question is answered, right answer was accepted
PLEASE HELP!!!! using BergZurgArcades guide having error!
im using BergZurgArcade's guide and there are three errors coming up. im a newb so please help!
1) CS1525: Unexpected symbol ':', expecting ')' or ','
2) CS1519: Unexpected symbol '' in class, struct, or interface member declaration
3) 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!!!!
Answer by syclamoth · Oct 24, 2011 at 11:49 PM
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.
Answer by roamcel · Oct 25, 2011 at 07:40 AM
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.
Answer by magicbananna · Mar 18, 2012 at 04:56 AM
you are missing a ) at the end of you gui line so it reads the code wrong easy fix
Answer by magicbananna · Mar 18, 2012 at 04:39 AM
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-----
Follow this Question
Related Questions
5 Errors, Need help, Unexpected symbol private etc 0 Answers
Unable To Find Solution For Errors 1 Answer
If CODE problems.. 1 Answer
Errors CS1525 and CS8025.... 1 Answer
Script Errors with C# 1 Answer