hi folks!
i’m trying to create simple game menu.
and it must hides/show then user press esc-key
i’m write some code but it no have any effect on UI visibility
why ? and how do this right ? for hide all or show all UI’s elements.
UI* ui = GetSubsystem<UI>();
UIElement* root = ui->GetRoot();
if (key == KEY_ESC)
{
if (isMainMenuActive_)
{
isMainMenuActive_ = false;
input_->SetMouseVisible(isMainMenuActive_);
root->SetVisible(isMainMenuActive_);
root->SetDeepEnabled(isMainMenuActive_);
}
else
{
isMainMenuActive_ = true;
input_->SetMouseVisible(isMainMenuActive_);
root->SetVisible(isMainMenuActive_);
root->SetDeepEnabled(isMainMenuActive_);
}
}