#Null Reference Exception Help

1 messages · Page 1 of 1 (latest)

terse summit
#

I'm working on some code and get the error Null Reference Exception. I am unsure of how to fix this code and would like some help. The error is line 105. When I am in range of the enemy, it throws up the NRE error, any ideas? https://hatebin.com/cpdjrgzssm

fiery gyro
#

Enemy doesn't have a BasicEnemy component. Calling die from a not found component threw the NRE. Relative to enemy.GetComponent<BasicEnemy>().Die()

#

Basically, you hit something with a collider that wasn't an enemy.