function OnControllerColliderHit (hit : ControllerColliderHit)
{
if ( hit.gameObject.CompareTag(“Bullet”) )
hit.gameObject.SetActive(false);
}
I’m putting this code into my enemy script to detect when he gets hit by a bullet, but I’ve noticed it’s running constantly as it’s picking up floors, walls and other colliders. As I intend this to be a mobile game, is that going to be bad for performance? For example, is it calculating all collision data every time it runs, or is the if statement good enough to ignore those calculations?