last version of godot steam
so im trying to create simple procgen thingy and i have a “room” that has nodes and each nodes spawns a room in those room instances there s more nodes to spawn more room that is kept in check in code to not create infinte loops
the problem is that new instantiated rooms dont spawn with nodes for some reason
extends Node3D
var rooms_array : Array = [preload("res://prefabs/rooms/room1.tscn"), preload("res://prefabs/rooms/room2.tscn"),preload("res://prefabs/rooms/room3.tscn"), preload("res://prefabs/rooms/room4.tscn") ]
@export var max_rooms_pre_randit : int
@export var rooms_min_random : float
@export var rooms_max_random : float
func _ready() -> void:
if !global.max_rooms_decided:
global.max_rooms = int(max_rooms_pre_randit * randf_range(rooms_min_random, rooms_max_random))
global.max_rooms_decided = true
print(global.max_rooms, global.rooms_spawned)
if global.rooms_spawned < global.max_rooms:
print(global.max_rooms, global.rooms_spawned)
try_to_spawn_room()
global.rooms_spawned += 1
func try_to_spawn_room():
var instance = rooms_array.pick_random().instantiate()
add_child(instance)
print("hello world i spawned a thing")
this i pretty much all the code and its in the spawn node
first room is not spawned but either just dragged into an editor