Material Box

Material Box

WEBデザイン & フリー素材

Godot - Nodeのタイプを取得する

Godot

Nodeのタイプを取得するGDScriptのコード例です。


GDScriptではget_class()にてNodeのタイプを取得する事が可能です。

var node = get_node("Sprite2D")
var node_type = node.get_class()

# Sprite2D

get_class()で指定した対象がノードではない場合、「Invalid call」エラーが発生します。

var x = 12
var node_type = x.get_class()

# Invalid call. Nonexistent function 'get_class' in base 'int'.

Godot

TitleGodot - Nodeのタイプを取得する

CategoryGodot

Created

Update

AuthorYousuke.U