Search Unity

Cannot check mirror checkbox on Blendtree in Animator

Discussion in '2D' started by robmpreston, Jun 13, 2016.

  1. robmpreston

    robmpreston

    Joined:
    Jul 29, 2013
    Posts:
    19
    Hi,

    I'm trying to setup 2d animation using an Animator and a blendtree. I've setup two side motions, one for left movement and one for right movement. On the left movement, i should be setting the Mirror setting to true, but clicking on it does nothing.

    I googled and saw several other people with this problem, with no resolution. Help?
     
    ojaoweir and czokka like this.
  2. czokka

    czokka

    Joined:
    Mar 14, 2017
    Posts:
    13
    still looking for a solution to this problem myself
     
  3. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    This only works on humanoid animations, not sprites. You'll have to mirror the sprite somewhere else. I usually just create a mirrored sprite separately.
     
    Rallix, Nicolas4677 and theANMATOR2b like this.
  4. raiszoliver

    raiszoliver

    Joined:
    Oct 1, 2019
    Posts:
    1
    It is easier to use the Sprite Renderer.Flip X property, IMHO.
     
  5. mrwensveen

    mrwensveen

    Joined:
    Oct 6, 2020
    Posts:
    1
    This is what I want to do, but I don't know how. Can you give me an example? I've already added the Sprite Renderer.Flip X property to the animation, but I don't know how I can control it from my blend tree.
     
  6. hungtracnguyen91

    hungtracnguyen91

    Joined:
    Sep 20, 2021
    Posts:
    1
    You can try sth like this inside your script

    if(movement.x > 0)
    {
    transform.localScale = new Vector2(-1f, 1f);
    } else if(movement.x < 0)
    {
    transform.localScale = new Vector2(1f, 1f);
    }
     
    iliys11potato likes this.