i am working on a unity game and the really anoying error keeps coming up! the error is
Assets/Melee_System.js(4,23): BCE0044: expecting EOF, found ‘1.5’.
here is my code
#pragma strict
var Damage : int; 50;
var Distance : float; 1.5
:melee
if input GetMouseButtonDown goto raycast;
:raycast
Raycast, Raycast.distance, goto damage;
:damage
if Raycast.distance, Damage;
can sombody please help me?
#pragma strict
var damage : int = 50;
var distance : float = 1.5;
function Melee()
{
if (Input.GetMouseButtonDown(0))
{
RayCast();
}
}
function RayCast ()
{
var hit : RaycastHit;
if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), hit, distance ) )
{
Damage (hit.distance);
}
}
function Damage (rayDistance : float)
{
Debug.Log (damage / rayDistance+"This wasn't going to do anything anyway.");
}
Here is my best attempt at translating the pseudocode you posted from facepalm to unityJS.
I advise you put aside Unity for a few months and just learn how to write a script the right way.
(“EOF expected” means the compiler was telling you; “just stop already!”)