Hi, I’m educated in CS, but I’m a beginner in Unity. Currently modifying the tutorial survival shooter by adding grenades.
Pulling my hair out a bit on this one, since the debugger shows the same gameobjects and colliders in both cases, but my GetComponent() call only returns null in the OverlapSphereNonAlloc case.
This Shoot() script correctly gets the EnemyHealth component from enemy colliders hit by Raycast, and applies damage correctly:
Whereas this Explosion() script correctly identifies enemy colliders in range, but gets only nulls from the GetComponent() calls:
To my eye, these calls are the same in terms of class/hierarchy relationships… so I can’t explain the failures in the grenade script. Unity version = 2020.2.1f1.
Would be really grateful for a pointer or two, so I can get back to building and learning! Thanks.