- Home /
This question was
closed Jul 01, 2015 at 09:24 PM by
meat5000 for the following reason:
Duplicate Question
Question by
Datester35 · Jul 01, 2015 at 09:22 PM ·
c#raycastraycasthit
C# raycast shooting script broken
Here is my script:
void Update () {
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
if (Input.GetMouseButtonDown(0))
{
if (Physics.Raycast (ray, hit, 100))
{
GameObject particleClone = (GameObject) Instantiate(Effect, hit.point, Quaternion.LookRotation(hit.normal));
Destroy(particleClone.gameObject, 2);
hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
}
}
}
How can I fix it? It is spouting out a bunch of errors. http://gyazo.com/f3b8b52fbdf6661bab373eb0f44d89df
Comment