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

  • January 29, 2024

    Inventory System v1.0 available

    Version 1.0 of the Inventory System is now available. It includes a few new additions since the closed beta: Lots of fixes found their way into this release as well:

  • February 10, 2024

    Inventory System v1.6 available

    Per feedback, we’ve exposed more inventory user interface component signals to make it easier to react to slot/item interactions with custom logic. New features: In addition, these bug fixes are included:

  • 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 …

  • 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 …

    © 2025 GoGoGodot.io. All rights reserved.