Hi,
Since I’m new to Unity3D I started creating a simple game menu and animated the buttons.
Currently I have a Main Menu and an Option Menu in one scene. I can switch between the menus by clicking on an ‘OPTIONS’ and a ‘BACK’ button.
Every time I switch between the Main and Option menu the animation of the buttons are starting (Fade in the buttons). How can I prevent this? I need the button animation (fading) only on startup of the whole app and then never again.
Does someone has an idea or can give me a hint how to solve this?
Okay!
Considering your animation name as
“HomeLoadingAnim” , “optionMenuAnim” , “helpMenuAnim”
- Tap on the Game Object which has animation component in it
- Open Animator (windows ->Animation → Animator)
- Now you’ll see “Entry” “Any State” “Exit” and the above mentioned animations
- Make “HomeLoadingAnim” as default animation (right click and select)
- Now select “Any State” and make transition to “optionMenuAnim” (by right clicking on any state)
- Now In left side select Parameters and create Triggers and Name it “playOptionAnim” (you can name it anything)
- Now select the transition line (from any state to optionMenuAnim) , now Inspector will open up , select the above trigger (hope you know how to do it)
- Now In code you have to do the following thing
//Add this below line in the function which opens the option menu
anim.Settrigger(“playOptionAnim”);