Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | kakubei |
Hello, I’m trying to convert a GDScript to C# equivalent. I’ve got an object that contains another object inside it and cannot access the second (child) object.
The GDScript code:
func _on_options(options):
var button_template = $VBoxContainer/ButtonTemplate
for option in options:
var button = button_template.duplicate()
button.text = option.line.text
I need to get the option.line.text
property.
I’m trying to work with the Wol GDSCript from here: https://github.com/bram-dingelstad/Wol/blob/main/README.md#Option
I’vet got the Wol Node already in my C# file and can access it without errors.
According to these docs: Cross-language scripting — Godot Engine (stable) documentation in English
I would image I need to do something like this:
var line = option.Get("line") as Line;
var newText = line.Get("text");
Of course, the problem is that my C# file doesn’t know what a Line
object is and that it should contain a text
property.
How can I access it in this case?
Cheers.