Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | TobiLa |
I don’t know if I have a false understanding of the tool mode, but I have a script which I try to execute in the editor. The script just loads another scene an tries to set a member variable. However, when that script get executed in the editor it throws an error:
Invalid set index ‘test’ (on base: ‘Node2D (AnotherScene.gd)’) with value of type ‘int’.
here is my script:
tool
extends Node2D
func _ready():
var anotherScene = load("res://AnotherScene.tscn").instance()
anotherScene.test = 3
AnotherScene.tscn contains just a node attached to this script:
extends Node2D
var test
Can anyone tell me why this is not working? Is this a bug or my misunderstaning?