Slot.gd
Learn about the Slot node, what it does, and why it's needed.
What is a Slot?
A slot is a node placed in a +layout.tscn used as a placeholder for pages or nested layouts. This effectively tells where a page should go to preserve its location in the scene tree.
It uses a custom class to allow adding to the scene directly and offers a @tool script to provide possible error messages.
File
Below is the entire code of the Slot.gd file.
@tool
extends Node
class_name RouterSlot
func _notification(what: int) -> void:
if what == NOTIFICATION_CHILD_ORDER_CHANGED:
update_configuration_warnings()
func _get_configuration_warnings() -> PackedStringArray:
if get_child_count() == 0:
return PackedStringArray()
return PackedStringArray([
"RouterSlot currently has children. Router navigation will replace all children under this node at runtime."
]) .gd