- Home /
Help Please-Unexpected symbol `Instantiate
I wanted to make bulletholes and raycast,but this error is annoying,somebody help please im new on this,about 4 days. thanks :)
using UnityEngine;
using System.Collections;
public class shoot : $$anonymous$$onoBehaviour {
public GameObject bullet;
public GameObject bulletHole;
public float delaytime = 8;
private float counter = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate ()
{
if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.$$anonymous$$ouse0) && counter > delaytime)
{
Instantiate(bullet, transform.position, transform.rotation);
GetComponent<AudioSource>().Play();
counter = 0;
RaycastHit hit;
Ray ray = new Ray(transform.position, Transform.forward);
if(Physics_Raycast(ray, out hit,100f)
Instantiate(bulletHole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal);
}
counter += Time.deltaTime;
}
}
Answer by Mouton · Jun 29, 2015 at 12:50 PM
You are missing a closing parenthesis at line 29
There is also an error with Physics_Raycast which should be Physics.Raycast
if (Physics.Raycast(ray, out hit, 100f))
Whenever you got an unexpected symbol error, look for the missing (or spare), symbol.
As stated by @tanoshimi, you should format your code properly next time.
Answer by tanoshimi · Jun 29, 2015 at 06:11 AM
When asking for help, please:
Format your code properly. Don't screenshot your code.
Include the full error message. It would tell us exactly where the error is.
In your case, however, the problem is apparent... I suggest you count how many brackets there are on line 28.
Answer by GiyomuGames · Jun 29, 2015 at 06:18 AM
Try removing the empty line 29 and/or put brackets around your Instantiate code line 30.