I’m looking to create a function that behaves similarly to the built in Unity functions Update(), Start(), Awake(), OnCollisionEnter(), etc.
I would like to place a function in several scripts and call all of them at once. For instance, let’s say I want to create a touch tracking function that will emit something like “touch_started()” and “touch_ended”.
I’d like to be able to add those functions to any number of scripts and have them get called from a different touch tracking script. I don’t want to manually call all of the instances where they are defined.
Rather than:
world_1_script.touch_started();
world_2_script.touch_started();
I’d like to be able to do something like:
*.touch_started();
(Obviously that’s not going to work and isn’t proper code. It’s simply an example to illustrate my objective)
Any help would be greatly appreciated. Thanks