Answer the question
In order to leave comments, you need to log in
How to fix NullReferenceException error?
There is a bullet object on it there is a script with the OnTriggerEnter2D function. The problem is that when creating a bullet next to a wall, it will be destroyed after a collision, but when the bullet hits the wall, we get this error
NullReferenceException: Object reference not set to an instance of an object Bullet.OnTriggerEnter2D (UnityEngine.Collider2D col) (at Assets/Scripts/Bullet.cs:23)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question