Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Idleman |
I don’t understand why I getting this error, the node is there but the editor keeps telling the node instance is null. It would be helpful if someone could point out where the problems is, thank you.
ERROR: Invalid set index ‘texture’ (on base: ‘null instance’) with
value of type ‘StreamTexture’
Scene:
Door (Area2D)
- Sprite
Script:
extends Area2D
onready var sprite = $Sprite
export var type = 0 setget set_texture
func set_texture(newSprite):
type = newSprite
if type == 1:
sprite.texture = load("res://Image/Door01.png")
if type == 2:
sprite.texture = load("res://Image/Door02.png")