How to z-order elements inside a layout ? (2D)
In a 2D project, I want to be able to drag elements organized by a horizontal layout group. I also want the element being dragged to be displayed over the other ones.
I tried changing its simblingIndex, but that does not work, because the siblingIndex is used to organize the elements in the layout. So when I drag my element and change its siblingIndex, it also changes its position within the layout, and I do not want that.
I tried to play with the canvas sort Order, but without luck.
What is the correct way to change z-order inside a layout withoout changing its siblingIndex ?
The architecture of my elements is:
+Canvas
++GameObject with layout grid
+++GameObject with the dragging script (1).
+++GameObject with the dragging script (2).
+++GameObject with the dragging script (etc).
Your answer
![](https://koobas.hobune.stream/wayback/20220612213752im_/https://answers.unity.com/themes/thub/images/avi.jpg)