I just now the basics of c# but for me this is advance. So could someone translate or give me suggestions?
using UnityEngine;
using System.Collections;
public class raycast : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
RaycastHit hit;
Ray downray = new Ray (transform.position, Vector3.forward);
Debug.DrawRay (transform.position, Vector3.forward * 10, Color.green);
if(Physics.Raycast (downray, out hit, 10))
{
if(hit.collider.tag=="Player")
{
Debug.Log("Hit player");
Debug.Log(hit.distance);
}
}
}
}