- Home /
Question by
FarouqLubay · Jul 07, 2013 at 08:53 PM ·
errorif-statements
Newb question
#pragma strict
var Damage : int = 50;
var Distance : float = 1.5;
var hit : RaycastHit;
function Update ()
{
if(Input.GetButtonDown("fire1"));
{
if(Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit));
{
Distance == hit.distance;
hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
}
}
}
Errors : Unexpected token: if. and expecting :, found ';'.
Comment
Best Answer
Answer by Bunnybomb7670 · Jul 07, 2013 at 08:58 PM
if(Input.GetButtonDown("fire1")); remove the " ; "
Your answer
![](https://koobas.hobune.stream/wayback/20220613105637im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
if statement error 1 Answer
Enum Type Inventory? 1 Answer
Whats wrong with this code? "expecting :, found '=' " error. 2 Answers
If gameobject moves do this 1 Answer
Error: Service not available, please try again later. 8 Answers