Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | DriNeo | |
Old Version | Published before Godot 3 was released. |
The error is: “Invalid set index ‘something’ (on base: ‘null instance’).”
What am I doing wrong ?
# autoloadFile.gd
extends Node
var something
class Slot extends Node:
func _init():
get_node(/root/autoloadFile).something = "Hello"
func _ready():
var instance = Slot.new()
print(something)
The error seems to be fixed with “_ready” function instead of “_init” but the last line doesn’t work and it doesn’t throw error.
extends Node
var something = ""
class Slot extends Node:
func _ready():
get_node("/root/autoloadFile").something = "Hello"
func _ready():
var oops = Slot.new()
print(something)
DriNeo | 2016-03-07 00:29