dark99 Posted July 22, 2024 Posted July 22, 2024 Hi? I tested skin layout. but widgets in another container doesn't applied with new skin layout Refer to screenshot, only 2 buttons downside applied by new skin layout. How can I apply skin layout to all widgets? Here is my code. ------------- auto gui = Gui::getCurrent(); gui->setSkinPath("../data/skin/"); auto hbox = WidgetHBox::create(); gui->addChild(hbox); hbox->addChild(buttonAdd); hbox->addChild(buttonRemove); gui->addChild(buttonSave); gui->addChild(buttonJson);
bmyagkov Posted July 23, 2024 Posted July 23, 2024 Hello! 17 hours ago, dark99 said: Hi? I tested skin layout. but widgets in another container doesn't applied with new skin layout Refer to screenshot, only 2 buttons downside applied by new skin layout. How can I apply skin layout to all widgets? Here is my code. We would be happy to help you but unfortunately the code you sent is not enough for us to determine what is going wrong. Could you please provide us with a simple sample project so we can reproduce the issue on our end? You can do this by archiving the existing project folder created from SDK Browser and share it via any convenient way. Alternatively, you can export the used world with sources as a package as described in the following article in our documentation: https://developer.unigine.com/en/docs/2.18.1/editor2/managing_packages/?rlang=cpp#export_browser_assets Thanks!
dark99 Posted July 23, 2024 Author Posted July 23, 2024 Hi I attached simplified project file. Only need to check Menu.cpp my_test (2).zip
bmyagkov Posted July 23, 2024 Posted July 23, 2024 @dark99 Thank you for sharing this data with us! We will investigate it shortly and get back to you as soon as we have any information. We hope this won't take long :) Thanks!
bmyagkov Posted July 23, 2024 Posted July 23, 2024 It seems that you need to apply the skin first and create the widgets only after that. So, the proper order would be something like the following: namespace TestPlay { void Menu::Init() { auto gui = Gui::getCurrent(); gui->setSkinPath("../data/skin/"); auto buttonAdd = WidgetButton::create("Add"); buttonAdd->setLifetime(Widget::LIFETIME_WORLD); buttonAdd->setWidth(200); auto buttonRemove = WidgetButton::create("Remove"); buttonRemove->setLifetime(Widget::LIFETIME_WORLD); buttonRemove->setWidth(200); auto buttonSave = WidgetButton::create("Save"); buttonSave->setLifetime(Widget::LIFETIME_WORLD); buttonSave->setWidth(200); auto buttonJson = WidgetButton::create("Json"); buttonJson->setLifetime(Widget::LIFETIME_WORLD); buttonJson->setWidth(200); auto hbox = WidgetHBox::create(); gui->addChild(hbox); hbox->addChild(buttonAdd); hbox->addChild(buttonRemove); gui->addChild(buttonSave); gui->addChild(buttonJson); } } With this approach behavior proceeded as expected: Thanks!
bmyagkov Posted August 5, 2024 Posted August 5, 2024 On 8/3/2024 at 2:06 PM, dark99 said: Thanks you ! It works fine You're welcome!
Recommended Posts