Help with Parsing Error

using UnityEngine;
using System.Collections;

var TheDamage Int = 50;
var Distance : float = 1.0;

function Update()
{
	if (Input.GetButtonDown ("fire1"))
	{
		var hit : RaycastHit;
		if (Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward),hit))
		{
			Distance=hit.distance;
			hit.transform.SendMessage("applydamage",damage,SendMessageOptions.DontRequireReceiver);
		}
	}
}

It says on line 4, character 17 that: Error CS8025; Parsing Error.
And to be honest, I don’t know why.

Unity Answers is intended for specific technical questions concerning Unity. This is just a basic case of not understanding programming syntax. You might want to follow some programming tutorials - there are plenty of good resources on the internet, or just click the “Learn” tab at the top of this page.

To answer your question:

var TheDamage Int = 50;

should be

var TheDamage : int = 50;

although later on I notice you try to use an otherwise undeclared variable called “damage”, so please make it consistent.

Capitalisation and attention to detail matter a lot :slight_smile:

Since no one mentioned it: “CSXXXX” errors are C# errors. So the script is actually a C# script with UnityScript syntax in it, not the other way round.

I know it’s kind of funny, but it doesn’t do any good for a Q&A site to be sarcastic without a clear answer / explanation.

The mentioned “solution” the OP has proposed in the comment above is not a solution. If you type “//” in front of a line that line is considered as comment and comments are simply ignored. Converting your code into comments doesn’t solve anything. Of course the compiler errors are gone, but just because there is no code anymore.