Disabling Canvas component does not hide UI - Bug report IN-68711

Unity 2022.3.18f1
PolySpatial 1.0.3
Bug report: IN-68711

Disabling the canvas component does not hide the UI.

It looks correct in the IDE, but not in Play to Device or in Simulator, in either Unbounded or Bounded mode. I do not have a device to test it on.

Thanks for the report! We’ll take a look shortly.

1 Like

Yeah, it looks like we don’t track the enabled state of the canvas. I believe we can fix that in an upcoming release; until then, the best workaround is probably to call SetActive(false) on the canvas’s GameObject to hide the contents (which of course requires putting the component that does the updates on a different GameObject, so that it will continue to update).

Any updates on this? SetActive() is much less performant for me due to the number and complexity of game objects on a canvas I’m currently working on. Using enable/disable on the canvas seems like a much simpler optimization for me than refactoring all the game objects for performance.

1 Like

Would be really good to know if this is likely to be implemented soon, otherwise there’s a significant amount of UI and code that will need to be refactored.

1 Like

We have this implemented internally, so it will go out with the next release. I don’t have a specific timeline for when that will be, other than “soon.”

2 Likes

I got around this for the time being by putting all of my content into CanvasGroups and not actually disabling anything. I just set the inactive group’s alpha to 0 and disable raycasting, colliders, or anything else that’d pickup input on the “disabled” group. I do the opposite when enabling a group. Works in simulator and is more performant for my case.