So, I am trying to build a menu's animations. I want all buttons but the pressed one shunted aside. But since writing a separate script for each button is less than elegant (and in case of dynamic buttons, impractical), I need to think of something else.
So, I want to make a script that will be hooked on several buttons. When any of them is pressed, the script is called, identifies which button called it, and excludes it from having its shunting animation used. For a pseudo-code description:
for (each button){
if (pressed_button != this_button){
run this_button's animation
}
}
But there's a problem: I can't for the life of me figure out how to identify the pressed button! Any tips?