Hello, I have been slowly learning how to make a simplistic GUI for a game, and I am unsure on how to update child objects when their parent changes. For example, I'd like to have a single master "UIParent" object that all objects are a child of. I could then hide the UIParent, and in turn hide every GUI Object.

My ideas so far have been:

When rendering simply check if the parent is visible and itself is visible, then draw. The problem here is that anything that is a child of a child of the UIParent (or further), will only see the visibility of the it's own parent, and nothing higher.

If on each update, I change the visibility flag on each object to that of the UIParent, then the update order would matter, and I would then need to keep two flags for parent visibility and self visibility. I don't think this would work for childen of anything that isn't the UIParent either. (I think, I'm second guessing myself on this one)

I could use some sort of message design pattern... I haven't thought too much on that, as it is not something I have experience with yet.

Do you have any ideas, or hints on what I should be trying to do?

Thanks