Swords and Shovels: why is aggro not handled with triggers?

Hi, in the Swords and Shovels tutorial, Michael handles aggro in the following way:

  • get a reference to the player through a FindWithTag
  • InvokeRepeating a “Tick” method every 0.5s
  • In that method does a distance check between monster and player transform to determine if the player is within aggro range.

I was wondering if that was the standard way of doing things, because so far I’ve always handled aggro with either a trigger collider, or sometimes OverlapSphere (or OverlapCircle, depending on situations).

So now I’m wondering if that distance-check method is the best solution performance-wise. How do YOU handle aggro in your games, I’m really curious

It isn’t my style, but I don’t have any issues with that method. Keep in mind that triggers would have their own costs, too.

I wouldn’t worry about this. Either method is likely to be relatively light as far as performance is concerned unless you have huge numbers of enemies. Because of that, I wouldn’t try to optimise it at first, I’d pick a method that’s easy to set up and maintain and I’d carry on. (I suspect that attaching one script is a bit easier than a script and a trigger and a Rigidbody and probably setting a layermask…)

Honestly, while I’d set things up a little differently for reasons of personal taste, under the hood I’d probably also use distance checks. I wouldn’t overcomplicate things unless there was a reason to do so.