Can you use triggers in script?

I don’t mean the animation triggers but instead of using a bool, but have something like if enemy is detected trigger this action, move to this position. So my question is what are some different ways of having something happen in script?

The first thing that comes to mind is using colliders set to triggers and having a monobehavior with the methods OnTriggerEnter,OnTriggerStay, and OnTriggerExit. There is a tutorial here. For triggers that are more about an objects state changing and less about moving into a collider’s trigger zone, you can also look into events and function delegates.

Well, the normal way would be function calls. You need to trigger functionality, you call a function.

Short of that, use a bool. If it’s set, then run your functionality and set it to false.