There were some errors on this code
void AttackDammage (){
//Attack function
RaycastHit hit;
ray = Camera.main.ScreenPointToRay(Vector3(Screen.width/2, Screen.height/2, 0));
if (Physics.Raycast (ray, hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
}
}
}
How can I fix these errors?
CS0103: The name `ray’ does not exist in the current context
UnityEngine.Physics.Raycast(UnityEngine.Vector3, UnityEngine.Vector3)’ has some invalid arguments