Hello Guys
Hereßs Dylan. Ive got some problem with the Healthbar. Theres always a error code : Assets/Standard Assets/Scripts/Utility Scripts/PlayerHealth .cs(18,107): error CS1525: Unexpected symbol ;', expecting )‘, or `,’.
But I dont get it. I used the same symbols. Whats wrong? Here?s the script:
using UnityEngine;
using System.Collections;
public class PlayerHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;
// 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;
}
}
874101–32642–$PlayerHealth .cs (389 Bytes)
Well you’re missing a “)” at the end of line 18
GUI.Box (new Rect(10, 10, Screen.width / 2 / (maxHealth / curHealth)), curHealth + "/" + maxHealth);
Thanks, but now there´s a new erroc code 
Assets/Standard Assets/Scripts/Utility Scripts/PlayerHealth.cs(18,70): error CS1729: The type UnityEngine.Rect' does not contain a constructor that takes 3’ arguments
Assets/Standard Assets/Scripts/Utility Scripts/PlayerHealth.cs(18,5): error CS1502: The best overloaded method match for UnityEngine.GUI.Box(UnityEngine.Rect, string)' has some invalid arguments* *Assets/Standard Assets/Scripts/Utility Scripts/PlayerHealth.cs(18,5): error CS1503: Argument #1’ cannot convert object' expression to type UnityEngine.Rect’
What do I need to do? I copy the right version from you in, but it now there´s a new error code
Your Rect has only 3 properties – 10, 10 and that Screen.width. Add the last, 4th one, and try and read the error code more in-peth – they usually provide a specific thing you need to fix (in this case, only 3 arguments instead of 4 on the Rect)
This is not how you are going to learn how to code…
You should be able to debug stuff yourself. When I saw your code, I immediately saw that there was a “)” missing.
Maybe you should be coding some simple applications first, do some tutorials to really understand how to code, and then dive into Unity.
Always close what you’ve opened. { } ( ) < >