Search Unity

Animation seems to be switching layers and I can't control it

Discussion in '2D' started by M1keTheKn1ght, Sep 1, 2021.

  1. M1keTheKn1ght

    M1keTheKn1ght

    Joined:
    Nov 13, 2020
    Posts:
    1
    I'm making a 2D game where a sprite continuously animates, but despite my setting the layers for it and fiddling around with the z coordinates for it and other sprites, the animation seems to be switching between different layers so that it flickers in and out of other sprites when it is being overlapped by another sprite. I've attached an example.

    Does anyone know how I can fix this?
     

    Attached Files:

    Last edited: Sep 1, 2021
  2. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    599
    Hey,

    The image link seems to be dead.

    The sprite sorting order is prioritized over the object's z-coordinate, so you shouldn't have to touch those at all if your sprites all have different sorting orders.

    Make sure that you haven't accidentally set sorting order keyframes that you didn't mean to in your animations. If you're using autokey, it's easy to accidentally set keyframes that you may not want, and that could cause the sorting order to be wrong.