hello, im trying to instance a scene in an endless runner im making, the idea is that once the platform is at a certain point, it will delete itself and instance a new one a bit ahead, how far away it is is determined by a collision polygon. for some reason, it is not instancing the scene even though everything else is working, what am i doing wrong? here is my code for the spawner:
extends Spatial
onready var tileScene = load("res://scenes/tile.tscn")
func _on_CollisionPolygon_tree_entered():
print("spawining")
tileScene.translation.z = 5;
var tile = tileScene.instance()
add_child(tile)
thanks in advance!