void LateUpdate() { // Manipulate z coord. to sort sprites tr -> bl Rect bounds = cam.WorldRect().Expand(2f); float maxZ = cam.farClipPlane * .95f; float horizontalStride = maxZ / bounds.size.y; Vec2 position = spriteContainer.position.xy(); Vec2 posNormalized = (position - bounds.min) / bounds.size; posNormalized = posNormalized.Clamp(0, 1); float z = posNormalized.y * maxZ + posNormalized.x * horizontalStride; spriteContainer.position = new Vec3(position.x, position.y, z); }