Search Unity

Bug Weapon animation breaks if you turn it off how to fix it?

Discussion in 'Animation' started by MrKsi, Oct 8, 2022.

  1. MrKsi

    MrKsi

    Joined:
    Aug 30, 2020
    Posts:
    139
    Greetings, I ran into such a problem, I have a first-person weapon that I turn off when the player breaks through the wall (SetActive false), and then turn it back on (SetActive true), after the player breaks through the wall, the animation of running and shooting broken on the weapon, although if you turn it on and off in debug mode everything works, normally, and up to the moment of breaking through the wall, everything also works fine. How can I fix this moment? Any ideas?
     
  2. MrKsi

    MrKsi

    Joined:
    Aug 30, 2020
    Posts:
    139
    Here's what it looks like:
     

    Attached Files:

  3. Nathanieljla

    Nathanieljla

    Joined:
    Apr 18, 2014
    Posts:
    97
    I really have no clue, but maybe you could look at Animator.keepAnimatorControllerStateOnDisable. The default is false, but I'm guessing in this case you'd want it to be true?