Hi I am a noob and I don’t undertand what the problem is. I got the script from a tutorial and it worked for him.
Script:
#pragma strict
//var Effect : Transform;
var TheDammage = 10;
var bulletHole : GameObject;
function Update () {
var hit : RaycastHit;
var 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))
{
if (hit.transform.tag == "Prop")
{
var bulletHoleClone = Instantiate(bulletHole, hit.point, hitRotation);
Destroy(bulletHoleClone.gameObject, 10);
}
hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
}
}
}
Here is my error:
Assets/Scripts/RaycastShooting.js(18,90): BCE0005: Unknown identifier: ‘hitRotation’.
I don’t understand why this isn’t working. It is the same as the guy uses in the tutorial I watched.