On which line is the null reference exception? That'll tell us what variable to look for. It seems *resetCol* could be null because you say the array is empty. This is because *resetCol* must have the same length as *colliders*, if it doesn't, then not all or any of the collided game objects will copy to the array. You have to set the length of the array first then copy it over
resetCol = new Collider[ colliders.Length ];
resetCol = colliders;
-
Also, use `if (collider.CompareTag( "Enemy" ) ) ` instead of *.tag*. It is much more efficient...
↧