Hi, so I am making a 2D game, and I have an enemy which will spawn in and go to a certain spot. These enemies have a circle collider with isTrigger that is bigger than them, and when the player is inside that collider, they follow the player until the player leaves that area. The player can attack the enemy, but I want the enemy to have a separate box collider so it can detect when the player hits them. (I want the OnTriggerEnter2D to trigger for the box collider and not the circle collider sometimes). Is there any way to do this?
This is a bad way to do this. You can instead use the Vector3.Distance function to find how far away the player is, and create your following logic around this function, and use the Collider for hitting.
Here is an example of how it works:
Unity Scripting API: Vector3.Distance