# Z-index poor solution

**URL:** <https://community.aseprite.org/t/z-index-poor-solution/28085>\
**Category:** Bug Reports\
**Created:** [February 23, 2026, 5:39pm UTC](https://community.aseprite.org/t/z-index-poor-solution/28085 "2026-02-23T17:39:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skullbrow](https://community.aseprite.org/user_avatar/community.aseprite.org/skullbrow/32/29386_2.png) [@skullbrow](https://community.aseprite.org/u/skullbrow)\
**Post date:** [February 23, 2026, 5:39pm UTC](https://community.aseprite.org/t/z-index-poor-solution/28085/1 "2026-02-23T17:39:24Z")

</div>

I’m making a character template and I wanted to put clothes on them, doing it in separate layers for each piece of clothing, but I need to place part of the shirt sleeve in front of the arm, so I used the Z-index, but negative to go behind. The problem is that the Z-index doesn’t work the same way in Engines where they are all 0 and if you set it to -1 it goes behind all others, so if I add a new layer it messes up the entire Z-index. Furthermore, I discovered that hiding any layer also messes everything up.

---

<div class="post-metadata">

**Author:** ![dacap](https://community.aseprite.org/user_avatar/community.aseprite.org/dacap/32/10_2.png) [@dacap](https://community.aseprite.org/u/dacap)\
**Post date:** [February 27, 2026, 2:33pm UTC](https://community.aseprite.org/t/z-index-poor-solution/28085/2 "2026-02-27T14:33:17Z")

</div>

Hi @skullbrow, the actual z-index solution is an index relative to the layer position.

The issue hiding layers looks like a bug to be fixed (I’ll create an issue related to this), the index should be relative to the layer position counting even hidden layers.

As you said other possibility would be to offer an absolute z-index, where everything is 0 by default and painted in order, and if something goes -1 goes to the background, and +1 goes at the front. I think with that option might be difficult to bring just one layer in one specific frame only, as it will require to set the z-index of all other layers too (e.g. if we want to put one layer above another, but all other layers should stay in the same position in front of everything else).

---

<div class="post-metadata">

**Author:** ![skullbrow](https://community.aseprite.org/user_avatar/community.aseprite.org/skullbrow/32/29386_2.png) [@skullbrow](https://community.aseprite.org/u/skullbrow)\
**Post date:** [February 27, 2026, 6:00pm UTC](https://community.aseprite.org/t/z-index-poor-solution/28085/3 "2026-02-27T18:00:03Z")

</div>

Hello,@decap, thank you for answer. I don’t know if I understand well but I think the engines works well with that. In Godot I can use nodes like layers and z-index if necessary.  
My biggest problem is making clothes/skins for the characters. I divide the template and the clothing into groups based on angles, but I need to separate the head, arms, and body. Since I need to make a shirt, I need to separate the shirt sleeves. All of this needs to be on top of the arm layer, but the part of the shirt without the sleeve needs to be below the arm. If I do this via layers, it becomes confusing because the sleeve layer is up there and the body layer is down there. It gets even worse when there are many clothes.  
Using z-index would solve it, even if it didn’t have a layer-hiding bug, it’s still quite bad because when I create a new layer, it messes up the entire z-index. Imagine I have 3 folders for North, East, and South angles, if I create a new outfit, I need to put it in all 3 folders, and each layer will receive a new layer, creating a complete mess.

---

<div class="post-metadata">

**Author:** ![Buschiix](https://community.aseprite.org/letter_avatar/buschiix/32/6_449c533f586939b6e5f246632a46421f.png) [@Buschiix](https://community.aseprite.org/u/Buschiix)\
**Post date:** [October 28, 2026, 5:56pm UTC](https://community.aseprite.org/t/z-index-poor-solution/28085/4 "2026-10-28T17:56:59Z")

</div>

Hi everyone!

I know this is an older thread, but I’m running into the same issue when creating modular characters with different equipment. Could an optional automatic adjustment mode preserve the existing relative z-index system while preventing layer changes from breaking established overlaps?

When enabled, it would work like this:

1. Inserting a layer between a cel’s own layer and the layer reached by its offset would increase the offset’s magnitude: +2 → +3, or −2 → −3.

2. Removing an intermediate layer would do the opposite: +2 → +1, or −2 → −1.

3. Moving a layer into that interval would behave like an insertion; moving one out would behave like a removal. Changes outside that interval would leave the offset unchanged. Moving several layers would adjust it by the corresponding number of layer positions.

The aim is to preserve existing nonzero offsets relative to the same layers, rather than blindly changing every cel’s z-index. Cels with a zero offset would continue following the normal layer order.

A toggle in the timeline, with an optional keyboard shortcut, would make switching convenient. When disabled, Aseprite would behave exactly as it does today. Adjustments should belong to the same Undo/Redo step as the original action, including drag-and-drop.

I’m experimenting with a Lua extension for this, but native support would avoid fragile workarounds around Undo/Redo.

Would this approach make sense? Thanks!
