enemy spawning doing.. nothing?

Godot Version

4.5.1

Question

Hiya, complete beginner here, but this enemy spawn code seems to do absolutely nothing? the print line in the spawner prints once so its running, but the enemy node doesnt appear in my tree or in my game… im at a loss for what could be doing this!!

func spawn_enemies():
	tile = availabletiles.pick_random()
	print(tile)
	if randf()< enemy_chance:
		enemytiles.append(tile)
		availabletiles.erase(tile)
	return enemytiles

func spawner(object_scene: PackedScene, tiles: Array):
	for tile in tiles:
		var object = object_scene.instantiate()
		add_child(object)
		print('enemy placed'+str(tile))
		object.global_position=tile
		

How do you verify that it didn’t spawn anything? Are you checking in the Remote tab?

Are there any errors in the console?

2 Likes

oh i do see it in the remote tab, i just dont see it in the game and i dont see a navigation line either (i have the debug lines on and all my enemies have navigation to the player) so its not actually appearing in the world?

Can you print hello in the ready func of the enemy?

Soo it will be clear that the enemy is spawning