- Home /
Find and set the object of an event type with script?
Project: 2D, Interactive Infographic. The screen is divided into two groups of buttons. Each button has a "sister" from the other group. This "sister" can be set and changed from the top of the prefab button instance. (My C# skill level is a beginner/intermediate.)
Goal: Any hover, click down and click up action on a button is mirrored on the "sister" button. This can be reversed like so: any hover and click on the sister is mirrored in the button instance.
Challenge:
I want to write a script that can find the sister from the hierarchy by name. (I got this part)
Then I want to put it in the event type within the inspector and set the function ( I don't got this part)
I know I can drag and drop each sister into the event trigger, but I don't want to do it 100+ times for each button. Also, I want to change the "sister" without digging into each button component. I don't know how to tinker with the event trigger and it's event types.
Any help with the challenge described or another approach altogether is appreciated.