I have tried setzindex() in code, and just setting the default zindex at the root of each individual scene which I will be instancing, on the assumption they will be instanced with that zindex.
But when my dagger node spawns an animated sprite (toonSmoke) with a z-index of 500 for the smoke, and 1000 for the dagger-the smoke always appears above the dagger.
if overlaps_target == true:
var smoke:Node2D = resSmoke.instance()
smoke.position = self.position
print("Dagger Z-Index: " + str(self.z_index))
print("Smoke Z-Index: " + str(smoke.z_index))
my console outputs:
Dagger Z-Index: 1000
Smoke Z-Index: 500
But my smoke is above my dagger:
It seems to just order them in scene tree order, and doesn’t care about zindex.