im stuck converting this script from java to c#
ive done all that i can see but thecompiler is telling me
line 10 error CS1002: Expecting `;’ from what i can see it is how it should be and how ive seen in on other bits of script. it just dosnt like the raycasthit variable for some reason,
ps im new to scripting if the reason is obvious
java script
var object1: Transform;
var object2: Transform;
var hit : RaycastHit;
function Update () {
if(Physics.Linecast(object1.position, object2.position, hit))
{
if(hit.collider.gameObject.tag != object2.tag)
{
Debug.Log("sight blocked by "+hit.collider.gameObject.name);
Debug.DrawLine(object1.position, object2.position,Color.red);
}
else
{
Debug.Log("sight not blocked");
Debug.DrawLine(object1.position, object2.position,Color.green);
}
}
}
C# script
using UnityEngine;
using System.Collections;
public class MYCLASSNAME : MonoBehaviour {
Transform object1;
Transform object2;
void Update (){
line10 private RaycastHit hit;
if(Physics.Linecast(object1.position, object2.position, hit))
{
if(hit.collider.gameObject.tag != object2.tag)
{
Debug.Log("sight blocked by "+hit.collider.gameObject.name);
Debug.DrawLine(object1.position, object2.position,Color.red);
}
else
{
Debug.Log("sight not blocked");
Debug.DrawLine(object1.position, object2.position,Color.green);
}
}
}
}