I’m making a game where there are a lot of events that has to happen when the player enter a certain area. Of course I do this using OnTriggerEnter2Ds and so on, but what annoys me is that I have to put them on separate scripts to work. What I would like to do is to put these on one master object that can distinguish between a lot of e.g. box collider 2d-s and know when what to do.
Is there a way to do this or I really have to wirte an own script for everything?
Thanks in advance.
make a generic script for all the areas that has a public UnityEvent Unity - Scripting API: UnityEvent use Invoke on the UnityEvent inside OnTriggerEnter.
Then you can choose which public functions get called from within the editor and you can put all the public functions in one script ( or more ).