Triggering animations in multiple parent objects (buttons) in a User Interface.
Hey there everybody,
I'm just starting out with Unity and need some help with this prototype for a User Interface that I want to build.
Basically I want to create a branch diagram and depending on which line you hover with your mouse the path leading to that line animates.
I created some (very crude) diagrams in photoshop show what I mean.
Scenario 1: Box no. 2 is hovered it changes the color of the path from 2 to 1 to a red color.
Scenario 2: Box no. 7 is hovered and it changes the color of every object on the path from 7 back to 1 to red.
I know how to create the animations for the highlighted state of a button. That's the easy part.
What I can't seem to figure out is how to set up the relations between all the button objects so that when it is hovered, it also triggers the animations for the parents.
Any help or suggestions how to achieve this would be greatly appreciated!
Answer by Schekka · Mar 01, 2016 at 04:00 PM
For anybody that finds this in the future I'll post the solution I found.
I was completely overthinking my approach towards this. Turns out you can just organize the parent-chil relationships in the hierarchy and when a button is hovered the higlighted animation will be triggered for that button and all of it's parents.
This is the end result of my prototype!
Now that I know how it works I'm comfortable implementing a UI like this in my game.