Is OnControllerColliderHit bad for performance?

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?

I’ve never really even thought about that. You’re going to need to be running code all the time to monitor collisions. IDK how else you would track the collision state.