Go, Go, Godot!
  • 0

Toggling Visibility of Nested CanvasLayers

November 27, 2024

I had a setup with nested CanvasLayer nodes. Toggling the visibility of the root CanvasLayer doesn’t hide any nested CanvasLayer nodes. My solution was to listen to the visibility_changed signal, find any CanvasLayer child nodes, and apply the same visibility to them.

func _ready() -> void:
	# If the visibility changes, apply it to any nested CanvasLayer nodes.
	visibility_changed.connect(func() -> void:
		find_children("*", "CanvasLayer", true, false).map(func(node: CanvasLayer) -> void:
			node.visible = visible
		)
	)

Posted in Godot.
Share
PreviousInventory System v1.18.1 available (and v2 progress update)
NextInventory System v1.18 available

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

  • February 16, 2024

    Inventory System v1.8.1 available

    A quick update to yesterday’s release with a few fixes:

  • July 4, 2024

    Inventory System v1.14 available

    A new version of the Inventory System is available with more multiplayer-related features. The Multiplayer Interaction Demo can now run in multiple modes, through two separate implementations of the Character scene: The simple character scene leverages the MultiplayerSynchronizer and can either let the client have authority and move the character, or have the client send …

  • August 1, 2022

    Running Godot Games on Steam Deck

    Right after I got my Steam Deck, I wanted to know how hard it is to get a Godot game running on it. What’s the developer experience for someone who’s stepping through this for the first time? It was really easy to do, so I’m sharing this here, whether you’re following along or like to …

  • September 25, 2023

    Generating documentation for GDScript

    Any sufficiently large code base needs documentation. Documentation tends to come in all sorts of shapes and sizes. Among them are high-level architecture and design docs, class and method interface documentation, and inline comments to explain optimized or complex algorithms so the reader doesn’t have to parse the logic in their head (often, this is …

    © 2025 GoGoGodot.io. All rights reserved.