i want to get a component value from the game object which collides with my trigger’s object script.
this is my code on the trigger:
void OnTriggerEnter (Collider obj){
if(obj.GetComponent<motor>().enabled == true){
passed = true;
}
}
and this is the error i get:
NullReferenceException: Object reference not set to an instance of an object
cp.OnTriggerEnter (UnityEngine.Collider obj) (at Assets/Scripts/cp.cs:15)