Godot Version
4.2.2
Question
im trying to add a PackedScene to the game scene but nothing happens
heres the code:
func _ready():
var new_entity = entities[0].instantiate()
new_entity.owner = get_parent()
4.2.2
im trying to add a PackedScene to the game scene but nothing happens
heres the code:
func _ready():
var new_entity = entities[0].instantiate()
new_entity.owner = get_parent()
add_child(new_entity)
after instantiate
tried that, didnt work
extends Node2D
@export var entities : Array[PackedScene] = []
@export_group("Spawning Options")
@export var delay = 5000
@export var amount = 2
@export_group("Spawning Range")
@export var range_x = 1024
@export var range_y = 1024
# Called when the node enters the scene tree for the first time.
func _ready():
var new_entity = entities[0].instantiate()
get_parent().add_child(new_entity)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
full code
doesnt work as in not visible or no node at all ?
check Remote Tab
yeah nothing
add
await get_tree().physics_frame
the first line of _ready() func
how is that supposed to work
the node is ready but the export doesnt ready yet, hence spawned to nothing
or it’s just your parent not ready, so you spawn to nothing
read what it is physics_frame from scene tree:
oh ok
thanks for the help
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.