I have 3 sprites, with the help of a script I change the rendering order and drag the sprites one on top of the other in reverse order.
The sprite that was at the bottom is obtained from above. But when you click on this stack again, it is not possible to take the top sprite.
Please tell me how can I solve this problem. I didn’t find a solution on the forum.
Version 3.6. I attach the presented script to each of the three nodes. So far this is an experiment with three sprites. I created nodes both in the editor and denamically in the script,
but the result is the same - this.node.setSiblingIndex(2) changes the rendering order, but does not remember the event processing order, and when you click on the visually top sprite again, the old node processing order is preserved.
Nodes/sprites are brothers. Tried making them children of the Canvas or children of the child node of the Canvas, the result is the same. In previous versions of the engine - target.setLocalZOrder(1) - solved the problem.
if you need,you can delete this code, and recompile engine.
Sorting can be time consuming and may affect performance.
File path:3.6.0\resources\resources\3d\engine\cocos\2d\event\pointer-event-dispatcher.ts