Godot Version
4.5.1
Question
I’m making a “wave spawner”, the wave spawner it reads the scene, the transforms and all that, but when adding the child to the scene I can’t see it.
The code is attached to a Node3D
In the code I call the function spawn_wave(), giving it an index of the wave and it should spawn the wave of enemies(aka; scenes) in their location.
For spawning I’m using an array of 2 resources: One containing the waves, and other containing the spawned scene and it’s location
# I call this on ready() for testing
func spawn_wave(wave_index: int) -> void:
var wave: Wave_Data = waves[wave_index]
for spawn_data : Enemy_Spawning in wave.spawned:
var scene: PackedScene = spawn_data.enemy_type
var enemy: Node = scene.instantiate()
var spawn_location : Node3D = get_node(spawn_data.location_node)
enemy.global_transform = spawn_location.global_transform
get_tree().current_scene.add_child(enemy)
