Hello!
Whenever I try to Test run my game, it says that all compile errors need to be fixed. The only problem being that unity isn’t giving me errors, any help?
Check that you’re showing everything in the Console. At the top right of the Console there are three buttons corresponding to warnings, errors, and logs. Make sure errors (the middle one) is on.
Ok so it gave me the error Assets/Melee.js(22,1): BCE0044: expecting }, found ".
If you’re expecting someone to help with that, you’ll need to post the relevant code.
This is the script i’m using.
#pragma strict
var dmg : int = 50;
var distance : float = 1.0;
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(“applydmg”,dmg,SendMessageOptions.DontRequireReceiver);
}
}
}
}
Please use code tags when posting code.
The only error in the script you posted is that you use “Distance” at one point when it should be “distance”.
Also you want to use “Update” instead of “update” (capitalization matters!) to get the desired functionality.
thanks! Sorry for not using the code tag.