Skip to content
Search

Godot:Metadata

lastmod 2021-01-30created 2021-01-301 edits

Caution

MetaData can be set on Godot:PackedScen.

var scene = GD.Load<PackedScene>("res://Scene/Component/Score/WholeNote.tscn");
scene.SetMeta(RHYTHM_NOTE_META_KEY, rhythmNote);
Debug.Assert(scene.HasMeta(RHYTHM_NOTE_META_KEY));  // OK

However, once it is instantiated with the .Instance() method, MetaData can no longer be used.

var node = scene.Instance() as Godot.Area2D;
node.Position = new Vector2(x, y);
Debug.Assert(node.HasMeta(RHYTHM_NOTE_META_KEY));  // ERROR !!

See also

author Zer0 sitemap