I am quite surprised how come nobody mention this but GlobalZOrder feature is so broken that I highly recommend others to not use it on the latest version.
I filed a bug a week ago and told about the basic issue in this forum as well. but now I understand the problem is much deeper then what I thought.
The problem in a nutshell -
Using SetGlobalZOrder break many of the features of cocos2dx such as :
TextureRender - when you try to capture a frame using ->visit the output is completely broken. you cant you TextureRender while using GlobalZOrder.
Using Scene transitions - any transitions that are done over a globalZOrder scene is broken.some elements are not affected by the transition. for example, a fadeout transition may still keep some of the nodes visible while tranisition applied.
Having said that, it seems that globalZOrder was added to the code but was not treated well with other features of cocos2dx. I highly suggest you warn people about it because now that I used it, it is a huge pain to go back.
Please do. this is really a huge problem. I have seen others complain about it in different scenarios. this is a huge problem and making global Z Order (which is blessed) useless.
OK, checking out the v3 branch of our GitHub repo may contain a fix. I don’t know if it does, but worth a shot. I am going to ask the engineering team to look at this thread too.
@Nuno147 i don’t use your zip file, just copy the modification you mentioned above. After invoking sprite->setGlobalZOrder(1);, closed menu item is hidden, how can you click it?
First thank you so much for taking a look into this.
On my end, the sprite isn’t over the button so I am not sure what is the problem on your end.
This is the picture before clicking while ZOrder is ON :
This is after clicking with ZOrder ON:
This is when ZOrder OFF and button was clicked (Expected result):
Btw, there is another issue I found which you can see in the picture (notice the title bar is over the text). it cause other issues with touch clicks but leave this for now
It is because i used cpp-empty-test to reproduce the issue, and the picture is big enough to fill the screen, after setting sprite’s global z order to 1, it is drawn after menu item, so it will hide the menu button.