Skip to content

Instantly share code, notes, and snippets.

@catvec
Created August 11, 2024 16:05
Show Gist options
  • Save catvec/76d364a4566fc0939d04d7a2a25d7c73 to your computer and use it in GitHub Desktop.
Save catvec/76d364a4566fc0939d04d7a2a25d7c73 to your computer and use it in GitHub Desktop.
public partial class Card : Node2D
{
private Label labelField;
private string _label = "";
[Export]
public string Label {
get { return _label; }
set {
if (labelField == null) {
return;
}
_setLabel(value);
}
}
private void _setLabel(string value) {
_label = value;
labelField.Text = _label;
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
labelField = GetNode<Label>("%Label");
_setLabel(_label);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment