Actually, there are two problems here, but here's the first and main problem -
I have an enemy class where I am attempting to ignore collision with the player.
In the enemy class I have -
There is a null reference exception as soon as I hit the...
Null reference exception for player object when trying to ignore collision
I have an enemy class where I am attempting to ignore collision with the player.
In the enemy class I have -
Code (CSharp):
- public GameObject player;
- private void Start()
- {
- player = GameObject.FindGameObjectWithTag("Player");
- Physics2D.IgnoreCollision(player.GetComponent<Collider2D>(), GetComponent<Collider2D>());
- }
Null reference exception for player object when trying to ignore collision