How to organize multiple colliders better in the scene
Greetings, 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.
Answer by DavidWatts · Aug 27, 2016 at 08:51 AM
make a generic script for all the areas that has a public UnityEvent https://docs.unity3d.com/ScriptReference/Events.UnityEvent.html 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 ).
Your answer
Follow this Question
Related Questions
How can a recover a deleted organitazion?,Is there a way to recover a removed organization? 0 Answers
What is the best method for noticing enemies? 0 Answers
Empty gameobject just to hold scripts? 2 Answers
Which is more efficient GameObject.Find() or public GameObject?? 3 Answers
Teammate added as Manager on both Organization and Project can't open project. 1 Answer