Need help resolving this Null Reference Error





The above is my WeaponLogic object, my Player object, and my test Cube all with their respective scripts. Its giving me a null reference error I cant seem to resolve. I thought I connected everything but i might need help resolving this. Thanks!

This one’s easy. In WeaponDamage you are accessing the alreadyCollidedWith list, but it is null. You never initialised it. The definition should be

private List<Collider> alreadyCollidedWith = new List<Collider>();

Initialise it, and your problem will go away

1 Like

Awesome that did it haha thank you! Knew i was overlooking something

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms