Question by
matt_sunley · Aug 29, 2015 at 09:48 AM ·
scripting problemerrorscript.error message
Object reference not set to an instance of an object (c#)
The problem is on line 20 but as I have little knowledge on scripting i'm not sure what the problem is.
using UnityEngine; using System.Collections;
public class DestroyScript : MonoBehaviour
{
public GameObject Explosion;
public int scoreValue;
private GameController gameController;
void OnTriggerEnter (Collider Other)
{
if(Other.tag == "Player")
{
Instantiate (Explosion,transform.position, transform.rotation);
Destroy(gameObject);
gameController.AddScore (scoreValue);
}
}
}
Comment
Since you haven't included all of your code, the line numbers are different. Where is line 20?
Your answer
![](https://koobas.hobune.stream/wayback/20220612001903im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Getting error on lap counter script JS 0 Answers
"The associated script cannot be loaded" 0 Answers
"The associated script cannot be loaded." 0 Answers
Script errors 1 Answer