Sprite animation problem

i have s sprite thats animated and for some reason individual frames of the the animation flick behind the floor image

like frame one of the animation is in front frames 2 &&3 are behind then frame four is infront again… im complete noob if there is any help i appreciate it

Sprites can have different meshes for each frame of the animation, try switching the scene window to “Shaded Wireframe” mode to see this. Unity by default will sort sprites by the centre position from the camera to the mesh and if the mesh changes shape that centre position of the mesh will change. You can either modify the “Order in Layer” on the sprite renderer to make sure the sprite is always in front (higher numbers are rendered in front). Or you can change the Camera sortAxis to be vertical or horizontal (depending on the view point of your game, top-down or side-on) then if the mesh is changing size it won’t affect the relative centre-point.

It could be your problem is not related to the mesh size, but even so try changing Order in Layer as that will override most other ordering logic.

1 Like

i fixed it … it was the layers haha