How do I print out text on my screen , throughout the game for my healthbar? when I tried what was prescribed in the unity site it gave some errors. This is my code.
using UnityEngine;
using System.Collections;
public class Controls : MonoBehaviour {
float h=10f;
void Start () {
GUI.Box( Rect (10,10, 100,50), null);
}
void Update () {
if (Input.GetKey (KeyCode.UpArrow)) {
transform.Translate (Vector3.forward * Time.deltaTime * 10f);
}
else if(Input.GetKey (KeyCode.DownArrow)) {
transform.Rotate(Vector3.up,500f*Time.deltaTime);
}
}
}
The Errors I get
1.
Assets/Space Stuff/Controls.cs(7,26): error CS0119: Expression denotes a type', where a
variable’, value' or
method group’ was expected
Assets/Space Stuff/Controls.cs(7,21): error CS1502: The best overloaded method match for `UnityEngine.GUI.Box(UnityEngine.Rect, string)’ has some invalid arguments
Assets/Space Stuff/Controls.cs(7,21): error CS1503: Argument #1' cannot convert
object’ expression to type `UnityEngine.Rect’