Disabled Canvas (4.6 UI) not hidden in Build version

Hello.
I got 3 canvases on a scene. Depending on situation, I need to hide one of them. I am trying
mainUI = GameObject.Find(“MainUI”);
mainUI.GetComponent().enabled = false; // or //
mainUI.SetActive(false);

Everything is OK in editor, but when I publish project to Win build, the canvases not hiding at all, they just change a view order;
What is the problem?

I’m not sure why it’s doing that but can you try this instead of setting enabled to false:

Add a CanvasGroup to the base Canvas for each menu then set the 3 settings as follows for each canvas:

mainUI.GetComponent<CanvasGroup>().alpha = 0;
mainUI.GetComponent<CanvasGroup>().interactable = false;
mainUI.GetComponent<CanvasGroup>().blocksRaycast = false;

Bit of pain to type but may fix your issue.