Created
August 11, 2024 16:05
-
-
Save catvec/76d364a4566fc0939d04d7a2a25d7c73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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