Archive 17/01/2023.

Sorry,I’m a beginner,ask a simple question

spwork

I use code create a button,and the button is not a button,it’s a white square,so,how to create a button correctly or other UI element?

1vanK

example 02_HelloGUI

    // Load XML file containing default UI style sheet
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");

    // Set the loaded style as default style
    uiRoot_->SetDefaultStyle(style);
button->SetStyleAuto();
spwork

Thank you, master, I forget SetStyleAuto()