How to make the button invalid while the canvas is loaded?

Hi!

By clicking on the “ButtonExit” button, the “LoadCanvas -> Ui_ConfirmExit.uicanvas” canvas is loaded, in the open canvas I click on the “ButtonExitNo” button, the canvas “UnloadCanvas -> Ui_ConfirmExit.uicanvas” is unloaded. If press the button more than 1 time “ButtonExit” then the loaded canvases “LoadCanvas -> Ui_ConfirmExit.uicanvas” are superimposed on each other. How to make, while the canvas is loaded “LoadCanvas -> Ui_ConfirmExit.uicanvas” button “ButtonExit” was invalid. But when “UnloadCanvas -> Ui_ConfirmExit.uicanvas”
button “ButtonExit” again became valid?

7387-ui-mainmenulist.txt (664 Bytes)ui-mainmenulist.txt 7388-ui-confirmexit.txt (539 Bytes)ui-confirmexit.txt

Hi Rimiro. I do not know Lua. But trying help you.

--Checks if the button is pressed
if (UiButtonNotificationBus.GetCurrentBusId() == self.Properties.ButtonExit && isNotExists(subCanvasEntityId))

You need before start load Ui_ConfirmExit. Check on exist canvas. Example function like is isNotExists(). That function is pseudo but i think you can check that using some function from UiCanvasManagerInterface::FindLoadedCanvasByPathName() this function have in c++ and i think in Lua too.