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

  • October 9, 2023

    Design Patterns for Building Friendships

    In this 2018 GDC session, Spry Fox‘s Daniel Cook explains how to keep human beings from being treated as interchangeable, disposable, or abusable when designing multiplayer games. If you’re developing, or thinking about developing a multiplayer game, this is a great talk to better understand the challenges of designing multiplayer interactions that result in more …

  • January 15, 2025

    Inventory System 2 Alpha 1 available

    The first alpha of the inventory system v2 is now available. For v2, a lot of refactoring work has been done with a focus on improving the developer experience. As part of that, the naming convention of the addon classes was streamlined and is more consistent now. The GDScript documentation comments have been improved significantly …

  • Godot Game Engine Logo
    September 15, 2022

    Godot Engine 4 reaches beta

    Just a couple of days ago, Godot 4.0 alpha 17 was announced. Today, Godot Engine 4.0 beta 1 was released. Be sure to check out the announcement. There are lots of improvements across the board; rendering, lighting, physics and navigation, animation, and scripting.

  • January 30, 2024

    Inventory System v1.1 available

    Hot on the heels of 1.0, version 1.1 allows for gaps in the inventory. This release also correctly bakes the release version into the PDF Guide.

    © 2025 GoGoGodot.io. All rights reserved.