In Unity, I am getting the following error:
NullReferenceException: Object reference not set to an instance of an object Burrow.OnMouseDown () (at Assets/Angry Birds Style/Scripts/Burrow.cs:16) UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32)
When I try to run this script:
using UnityEngine;
using System.Collections;
public class Burrow : MonoBehaviour {
void Start () {
}
void Update () {
}
void OnMouseDown() {
if (!GameObject.Find("Projectile").GetComponent<ProjectileDragging>().launch) {
GameObject.Find("Projectile").GetComponent<ProjectileDragging>().burrow = true;
}
}
}
This script is attempting to reference variables from a script from a separate object in Unity.