originalnicodr / CinematicUnityExplorer

UnityExplorer fork focused on providing tools for creating marketing material for Unity games.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make the HUD toggle also catch new UI elements when its already toggled off

originalnicodr opened this issue · comments

Describe the issue

At the time of writing, when toggling the HUD off, if new UI elements happen to be introduced on screen then our HUD toggler would need to be turned on and off again to detect them and be able to turn them off. It would be nice if instead, it's able to catch these UI elements appearing on screen and capture them.

The main problem I believe is that, when a new UI element is drawn on screen is either created in the moment or enabled by a property. Therefore, I tried patching the setter method for the enabled property, as well as the Canvas constructor to catch these Canvas objects and disable them, with poor results (the patching works, but does not fix the problem).

Because of how the Canvas elements work, disabling them won't prevent their future children from rendering on screen. Or so is my understanding.

I also played a bit with the idea of using another class, such as CanvasRenderer or CanvasGroup, to see if I could have something working in which, once disabled, new elements would also get automatically disabled. But none of them worked like this.

It might be a good idea to check this with someone who knows the engine better for ideas.