- Home /
Question by
bananapoju · Oct 09, 2013 at 03:12 PM ·
syntax error
Help with syntax error
Please help me. expecting :,found }
. (16,12) my Script:
private var ray : Ray;
private var rayCastHit : RaycastHit;
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
ray = Camera.main.ScreenPointToRay(I-nput.mousePosition);
if(Physics.Raycast (ray, rayCastHit))
{
if (rayCastHit.transform.name == "Play") {
{
Application.LoadLevel("MainGame")
}
}
}
}
Comment
Answer by robertbu · Oct 09, 2013 at 03:20 PM
Line 8: 'I-nput' should be 'Input'
Line 11 or 12: remove one '{'
Line 13: Need a ';' at the end
private var ray : Ray;
private var rayCastHit : RaycastHit;
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast (ray, rayCastHit))
{
if (rayCastHit.transform.name == "Play")
{
Application.LoadLevel("MainGame");
}
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613115616im_/https://answers.unity.com/themes/thub/images/avi.jpg)