Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Guide to the Godot game engine/Programming/GDScript/Making nodes

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Programming/GDScript/Manipulate scene tree Programming/GDScript/Tips And Tricks Manipulating the SceneTree Tips and Tricks Making new nodes can be easy or hard, depending on the planned node. Some will just require this guide, some will benefit from being introduced with an entire plugin. This guide will assume the former. Write this code: tool extends Node class_name TestNode export var message = "Hello world!" setget set_message func _ready(): print(message) func set_message(value): if value and value is String: message = value The setget tells the engine to run set_message whenever you try to change message. In this particular example, you cannot empty it. Because of the tool, this runs even if you change the value in the inspector. The class_name tells the engine to add the script to the add node popup, add it to the auto-correction list and to allow you to instance it with TestNode.new(). <noinclude>