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 have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

2D Animation flickering between states

Discussion in '2D' started by Tobertet, May 10, 2020.

  1. Tobertet

    Tobertet

    Joined:
    May 7, 2020
    Posts:
    4
    Hello guys

    I am having a weird behaviour in my Unity 2D game... I hope some1 can help me here.

    I am trying to have different sprites and animations depending on what the user is doing and wearing. There are like 3 levels of states. A first level with the player action (Idle, Walking, Picking...), a second level with the player direction (Right, Left, Front, Back) and a third level with the amount of food being carried (0%, 20%, 40%...). So, here is how my states look like.

    1st lvl
    upload_2020-5-10_19-1-24.png

    2nd level (inside Carrying):
    upload_2020-5-10_19-2-1.png

    3rd level (inside playercarryingfront)
    upload_2020-5-10_19-2-37.png

    All transitions have been created manually (oh god) and set to TransitionDuration=0 and HasExitTime=false.

    The problem I am having is, when my player is carrying food, for some reason, when transitioning between carrying and holding and viceversa, the default sprite in the SpriteRenderer appears. Thus, a flickering in the animation appears and the result is a weird experience.

    My only guess is somehow the "Empty" state is being displayed which has a None animation and also should be instantaneous. However, all these animations are the same in Walking and Idle and they are working correctly.

    Can some1 help me? Also, is there any other way no to be configuring manually all the 1000 repeated transitions between states?

    Thanks in advance
     
  2. Tobertet

    Tobertet

    Joined:
    May 7, 2020
    Posts:
    4
    Update
    I've been struggling the whole day and I just found that changing the 3rd level substate to the following one fixes the problem.

    upload_2020-5-10_22-53-27.png

    For me, it makes no sense. Does anybody know what the hell happened?
     
  3. NineHydras

    NineHydras

    Joined:
    Aug 9, 2020
    Posts:
    1
    Hi, I'm having almost the exact same problem! I'm currently filtering logic like "what weapon" based off an int and then "okay, now what animation for that weapon" based off an int like such:
    upload_2020-8-9_0-34-17.png

    Just like yours, my default sprite flickers for a fraction of a second.

    I'm extremely curious what on earth is happening in the last pic you posted, none of the other things look like they are hooked up but you said it's working???

    Also I'm so tired of manually changing everything to 0 transition time, no exit time, etc as well lol