- Home /
Question by
thepremiumside · Feb 08, 2014 at 05:42 AM ·
scripting problemscrip
expecting (, found 'OnGui' HELP!!!
var playerSpeed : int;
var playerLives : int;
static var playerScore : int;
var bullet : Rigidbody;
function Update () {
amtToMove = (playerSpeed * Input.GetAxis("Horizontal")) * Time.deltaTime;
transform.Translate(Vector3.right * amtToMove);
if( Input.GetKeyDown("space")){
var tempBullet : Rigidbody;
tempBullet = Instantiate(bullet,transform.position,transform.rotation);
}
function OnGUI(){
GUI.Label(Rect(10,10,200,50),"Score:" + playerScore);
GUI.Label(Rect(10,30,200,50),"Lives:" + playerLives);
}
please help I am completely lost and have tried doing everything it says please be aware I am very new to scripting and unity and don't know a lot!
Comment
Best Answer
Answer by getyour411 · Feb 08, 2014 at 05:44 AM
Please format your code when posting at UA using 10101 button. You are missing a closing } at the end, before the "function OnGUI" to close out the Update()
Your answer
![](https://koobas.hobune.stream/wayback/20220613132901im_/https://answers.unity.com/themes/thub/images/avi.jpg)