Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

ScriptCreateDialog

继承: ConfirmationDialog < AcceptDialog < Window < Viewport < Node < Object

Godot 编辑器用于创建新 Script 文件的弹出对话框。

描述

ScriptCreateDialog 会根据给定的模板为给定的脚本语言创建脚本文件。标准用法是在调用任何 Window.popup 方法之前,先配置其字段。

func _ready():
    var dialog = ScriptCreateDialog.new();
    dialog.config("Node", "res://new_node.gd") # 对于引擎内置类型。
    dialog.config("\"res://base_node.gd\"", "res://derived_node.gd") # 对于脚本类型。
    dialog.popup_centered()

属性

bool

dialog_hide_on_ok

false (overrides AcceptDialog)

String

ok_button_text

"Create" (overrides AcceptDialog)

String

title

"Attach Node Script" (overrides Window)

方法

void

config ( String inherits, String path, bool built_in_enabled=true, bool load_enabled=true )


信号

script_created ( Script script )

当用户点击确定按钮时发出。


方法说明

void config ( String inherits, String path, bool built_in_enabled=true, bool load_enabled=true )

预填必填字段以配置 ScriptCreateDialog 以供使用。