- Home /
Question by
evildumdum · Aug 31, 2014 at 06:42 AM ·
javascripterrorfire1
enemy mechanics script and declining health
so i cleared up both scripts with no bugs or errors but things don't seem to be working. im getting the error:
UnityException: Input Button fire1 is not setup. To change the input settings use: Edit -> Project Settings -> Input MelleSystem.Update () (at Assets/scripts/MelleSystem.js:9)
i know what this means and i thought i knew how to fix it but it didn't work
here is the script
#pragma strict
var Damage : 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", Damage, SendMessageOptions.DontRequireReceiver)
);
}
as well as the simple enemy Logic script that goes with it.
#pragma strict
var Health = 100;
function Update ()
{
if (Health <= 0)
{
Dead();
}
}
function ApplyDamage (Damage : int)
{
Health -= Damage;
}
function Dead()
{
Destroy (gameObject);
}
thank you.
Comment
Answer by Kiwasi · Aug 31, 2014 at 07:00 AM
Try "Fire1"
The capitalisation has to match the input axis exactly. Follow the menu chain in the error message to see what the axis is called in your project.
Your answer
![](https://koobas.hobune.stream/wayback/20220613161926im_/https://answers.unity.com/themes/thub/images/avi.jpg)