{"action":"created","issue":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/13682","labels_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/13682/labels{/name}","comments_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/13682/comments","events_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/13682/events","html_url":"https://github.com/cocos2d/cocos2d-x/issues/13682","id":104899156,"number":13682,"title":"setGlobalZOrder on ui::Widgets has no effect.","user":{"login":"adilson63","id":13041480,"avatar_url":"https://avatars.githubusercontent.com/u/13041480?v=3","gravatar_id":"","url":"https://api.github.com/users/adilson63","html_url":"https://github.com/adilson63","followers_url":"https://api.github.com/users/adilson63/followers","following_url":"https://api.github.com/users/adilson63/following{/other_user}","gists_url":"https://api.github.com/users/adilson63/gists{/gist_id}","starred_url":"https://api.github.com/users/adilson63/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adilson63/subscriptions","organizations_url":"https://api.github.com/users/adilson63/orgs","repos_url":"https://api.github.com/users/adilson63/repos","events_url":"https://api.github.com/users/adilson63/events{/privacy}","received_events_url":"https://api.github.com/users/adilson63/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-04T14:17:17Z","updated_at":"2015-09-24T22:00:03Z","closed_at":"2015-09-05T04:15:37Z","body":"Hi guys,\r\n I'm fighting an issue on v3.6 and confirmed if on v3.7 too. \r\n I've many scenes where I've on top of sprites some labels/text. All scenes were built using cocos studio.\r\n The issue is that I've enemies coming from off screen on the top of the screen, they are moving across the top HUD bar where the player number of lives, resources, score, etc are. When there are too many enemies they cover the whole HUD bar.\r\n Trying to fix the issue I tried to set the global z order of all sprites and widgets that make the top HUD bar. However, for the sprite the global z order work fine but the any ui::widget component it doesn't. The widget doesn't render on top of the sprites as expected. I though they were disappearing, then I set the sprites visible to false and I saw them. Basically, they are being rendered behind the sprites. \r\n It doesn't matter what z order I set, like 100 to the sprites and 150 to the labels, loadingbar, they just don't render properly.\r\n I've successfully reproduced the issue on v3.7 in a small project. I put 1 sprite and 1 label on the screen and on the code I set their global z order, the sprite is rendered on top of the label.\r\n\r\n```\r\n  auto rootNode = CSLoader::createNode(\"MainScene.csb\");\r\n\r\n    addChild(rootNode);\r\n\r\n    \r\n    auto spaceship1 = static_cast<cocos2d::Sprite*>(rootNode->getChildByName(\"mycra_ori_1\"));\r\n    if(spaceship1!=nullptr){\r\n        cout << \"spaceship1 found it\" << endl;\r\n    }\r\n    spaceship1->setGlobalZOrder(100);\r\n    auto resourcesText = static_cast<cocos2d::ui::Text*>(rootNode->getChildByName(\"Text_1\"));\r\n    if(resourcesText!=nullptr){\r\n        cout << \"resourcesText found it\" << endl;\r\n    }\r\n    resourcesText->setGlobalZOrder(140);\r\n```\r\n\r\nThis is the scene in Cocos Studio.\r\n![screen shot 2015-09-05 at 00 13 33](https://cloud.githubusercontent.com/assets/13041480/9685679/1debbee0-5363-11e5-9a93-7dc8cbd05fe5.png)\r\n\r\nThis is the output on the ios simulator.\r\n![screen shot 2015-09-05 at 00 15 41](https://cloud.githubusercontent.com/assets/13041480/9685707/4b45078e-5363-11e5-936f-1f9c139fb986.png)\r\n\r\nI appreciate any help and a confirmation whether this is really a bug. I've a problem that I may have to re-do all my scenes manually because this issue. I hope I don't have too... thank you"},"comment":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/comments/143061607","html_url":"https://github.com/cocos2d/cocos2d-x/issues/13682#issuecomment-143061607","issue_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/13682","id":143061607,"user":{"login":"Dredok","id":1898021,"avatar_url":"https://avatars.githubusercontent.com/u/1898021?v=3","gravatar_id":"","url":"https://api.github.com/users/Dredok","html_url":"https://github.com/Dredok","followers_url":"https://api.github.com/users/Dredok/followers","following_url":"https://api.github.com/users/Dredok/following{/other_user}","gists_url":"https://api.github.com/users/Dredok/gists{/gist_id}","starred_url":"https://api.github.com/users/Dredok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dredok/subscriptions","organizations_url":"https://api.github.com/users/Dredok/orgs","repos_url":"https://api.github.com/users/Dredok/repos","events_url":"https://api.github.com/users/Dredok/events{/privacy}","received_events_url":"https://api.github.com/users/Dredok/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T22:00:03Z","updated_at":"2015-09-24T22:00:03Z","body":"What I have done till now is to override setGlobalZOrder in Widget, Label, Scale9Sprite and UILayout. Also in Label I had to setGlobalZOrder of _textSprite.\r\n\r\nIt's almost working :-)"}}