I am creating enemies for a mobile 2D side-scrolling game. Here is how the enemy works - if the player is near them, the enemy shoots a bullet at them. I have two ideas how to do this - add a trigger zone (collider set to “is trigger”) to the enemy game object, or, check to see if the distance between the enemy and player is less than a certain amount. Since this is a mobile game, I am concerned about hardware constraints so which method is better for quickness, speed, overhead. etc. All advice is greatly appreciated.
You could go either way. If it’s a 2D sidescroller i’m going to assume that you won’t have entirely too many enemies on your screen. If that’s the case, I’d personally do position checking. If you have a lot of objects on your screen at any point in the game, I’d go with a trigger zone.