using UnityEngine;
using System.Collections;
public class RayControl : MonoBehaviour {
public Transform target;
void Update () {
RaycastHit hit = new RaycastHit();
Debug.DrawRay(this.transform.position, target.transform.position - transform.position, Color.green);
Ray ray = new Ray(this.transform.position, target.transform.position - transform.position);
if (Physics.Raycast(this.transform.position, target.transform.position - transform.position))
{
if (hit.collider.tag == "Obstacle")
{
Debug.Log("Yes");
}
}
}
}
>>>>>>>>>>> Выдает ошибку ! не знаю почему . Помогите исправить !
Ошибка ! -- NullReferenceException: Object reference not set to an instance of an object
RayControl.Update () (at Assets/New/RayControl.cs:14)