Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Resolved Problem with button animation between active and inactive objects

Discussion in 'Animation' started by LeoFeitosa, Feb 13, 2021.

  1. LeoFeitosa

    LeoFeitosa

    Joined:
    Jul 5, 2017
    Posts:
    30
    Hello everybody.
    I'm having trouble with button animations.
    I have two objects, the first containing the main menu buttons and the second containing the settings menu buttons.
    When I press the options button, the main menu is set to disabled "GameObject.SetActive (false)" o the options menu is set to true, inside the options menu there is a back button, which does exactly the opposite.
    This is the problem, when I press the back button the main menu is displayed, but the animations no longer correspond to the clips: normal, selected, pressed etc.
    Could anyone tell me why this happens and how to solve it?
     
  2. M-Elwy

    M-Elwy

    Joined:
    Jan 28, 2021
    Posts:
    38
    Have you re-activated the main menu
    "GameObject.SetActive(True)"
    ?
     
  3. LeoFeitosa

    LeoFeitosa

    Joined:
    Jul 5, 2017
    Posts:
    30
    yes I reactivated, the buttons appear but with a problem in the animations
     
  4. M-Elwy

    M-Elwy

    Joined:
    Jan 28, 2021
    Posts:
    38
    Do the buttons function correctly? If you pressed "Enter" or the button you use for submission, do any of the main menu buttons gets pressed (I mean as a function not animation)
     
  5. LeoFeitosa

    LeoFeitosa

    Joined:
    Jul 5, 2017
    Posts:
    30
    yes it works normally
     
  6. Aaron4321

    Aaron4321

    Joined:
    Feb 15, 2022
    Posts:
    1
    Ik heb hetzelfde probleem, ik weet niet wat ik moet doen. weet je al hoe je het moet maken?
    het zou leuk zijn als je me ermee zou kunnen helpen
    bedankt
     
  7. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    252
    Unity animation system has design flaw which in the default config without nonobvious hacks makes it unusable. There are plenty of discussions of it: https://forum.unity.com/threads/ani...-change-through-the-animations-itself.509668/ https://forum.unity.com/threads/write-defaults-confusion-bug.392058/ https://forum.unity.com/threads/imp...mator-default-values-in-all-scenarios.394618/

    Simplest workaround for which works for me is enabling keepAnimatorControllerStateOnDisable . It's not a perfect solution in other situtions like animated characters, but seems to be good enough for UI stuff.
     
unityunity