Material Box

Material Box

WEBデザイン & フリー素材

Godot - Buttonノードを新規作成する

Godot

GDScriptからButtonノードを新規作成する方法とコード例です。


Button.new()にてスクリプトからButtonノードを作成します。
表示するにはadd_child()で子要素に追加する必要があります。
Buttonノードはサイズ指定は必須ではありません。

# Buttonノードを作成する
var button = Button.new()
add_child(button)
button.text = "Button"

# Buttonノードの位置を変更する
button.position = Vector2(200, 200)

Godot

TitleGodot - Buttonノードを新規作成する

CategoryGodot

Created

Update

AuthorYousuke.U