I’m a few months into development on a project, and I have a couple dozens GameObjects, and probably hundreds of different buttons inside these prefabs. I want to capture an analytics event where the button clicked gets logged somewhere, but I want this to happen for every single button clicked. I didn’t want to go through every prefab, one by one, and add a separate component to its button on click; that seems excessive, and also like a waste of memory.
Is there an easy way to globally call a specific function for each Button when its OnClick is called, and have it pass the button’s gameobject itself as a parameter to that function? I’m trying to mess around with the Standalone Input Module, but some buttons, when clicked, destroy themselves, and these aren’t being captured via MouseButtonUp() (maybe because it gets destroyed before MouseButtonUp() detects the object? Not sure).