Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | imekon |
This function complains: Invalid set index ‘text’ (on base: ‘Nil’) with a value of type ‘String’. I don’t understand why.
extends KinematicBody2D
onready var registration = $Label
func set_ship_registration(text):
registration.text = text
when set_ship_registration(text) is called in Main:
func generate_ship(scene, x, y, reg):
var ship = scene.instance()
ship.position = Vector2(x, y)
ship.set_ship_registration(reg)
add_child(ship)
There’s a sample project here: GitHub - imekon/text1: Sample of Godot error