I am wondering how can I make it so all units that are position.y above building they are rendered behind it, and if their position is below the building then they rendered above it...
Let me know if you can't understand the question and need images...
Currently I try following, but it does not do anything and even if it did I imagine it would be quite taxing ?
for i in get_children():
if i.global_position.y < $Building.global_position.y:
i.z_index = -1
i.z_index = 3