add_child error?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By morningkingdom

i have a sprite and i wanna use export var for loading insteed of preload(“…”) for performance issues.

export var first_teleport_sprite : PackedScene # call 

func _process(delta):

first_teleport_sprite.instance()
first_teleport_child_node.add_child(first_teleport_sprite)

thise are nodes:
nodes

and this is error:
error

im using the same way for two diffrent resource, but only thing diffrent between them other two that work fine are 3d meshh (kinematic body and rigid body)
but this one is a sprite3D.

this one :

so why i am getting this error ?

:bust_in_silhouette: Reply From: kuza14.games

Try

export var first_teleport_sprite : PackedScene # call

func _process(delta):
var instance = first_teleport_sprite.instance()
first_teleport_child_node.add_child(instance)

feel stupid :smiley:

thanks.

morningkingdom | 2021-04-03 13:54

Nothing.(my first anwser yay)

kuza14.games | 2021-04-03 15:34