Opacity or Visible?

Please can anyone explain to me how can I manage with visibility on node?

So, I 'd like to have something like this.node.opacity = 0 or this.node.visible = false/true

node.active = true/false // works only first time only

Node is a node, which is pure logical, it doesn’t have a visibility state.
What you need is to control enable of renderable component, like MeshRenderer, Sprite

I have a structure like that:
Screenshot 2023-04-17 at 11.49.22 AM
where game is a pure node

  1. I need to hide game and all the children

Give me please the best solution?

If it’s a sub tree inside a Canvas, you can use UIOpacity, which handles opacity cascade, so that you can set opacity for the root node
For 3d scene and nodes, you should use node.getComponentsInChildren(Renderer) to get all renderable components and set their enable states

So your suggestion is: if I need to hide 100 children of single node I have to get all the list and then set UIOpacity for everyone in a loop?

UIOpacity can be cascade in the sub tree, so you can set once in the root node, but it’s only supported in UI nodes under Canvas

1 Like