Im watching brackeys tutorial for survival game and i set fire1 to do all this and that with a left clicking the mouse but it will not do anything. I am not sure if its binded to left click on mouse, i did go to the settings and it said left ctrl but i dont understand the settings. Yes im am new to Unity and programming. If you want the code for my enemy just ask. This is in java btw.
HERE IS MY CODE
#pragma strict
var TheDamage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
function Update ()
{
if (Input.GetButtonDown("Fire1"))
{
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver);
}
}
}
}