Unity3D: NullReferenceException: Object reference not set to an instance of an object
问题 I want to access Hero.class variable "aspect" from laserController.class, but I receive an error message : NullReferenceException: Object reference not set to an instance of an object . Hero.class using UnityEngine; using System.Collections; public class Hero : MonoBehaviour { public float aspect = 0.1f; void Update () { } } laserController.class using UnityEngine; using System.Collections; public class laserController : MonoBehaviour { public float health = 0f; //public float aspect = 0.1f;