In this tutorial we are going to build up from the beginner tutorial and write a slightly more complex system. This new system will allow to set up virtual layers for the Z order, allowing objects to stay on top even if other objects have a larger Y coordinate.
We will take the same ZOrder family as the previous tutorial. We will add a new variable named “layer” next to the “order” variable. This “layer” variable will host the layer number the object will be on.
We will now extend the beginner code to account for this new change.
That way, the order variable for higher layers will be higher than that of lower layers. LayoutHeight is only used as an arbitrary large value. If you have objects outside the layout boundaries, and/or are using unbounded scrolling, you might want to give it a larger number to avoid weird issues.