private void OnDrawGizmos() { var pos = (float3)transform.position; var size = (float3)transform.localScale; var tree = new QuadTree(pos.xy, size.xy, Allocator.Temp); var positions = new NativeArray <float2>(targets.Length, Allocator.Temp); for (var i = 0; i < targets.Length; i++) { positions[i] = ((float3)targets[i].position).xy; } tree.Construct(positions, new LODBuilder(radius, maxLODs)); var branches = tree.branches; var c = Gizmos.color; for (var i = 0; i < branches.Length; i++) { var b = branches[i].Bounds; var sw = new float3(b.SWCorner, 0); var nw = new float3(b.NWCorner, 0); var ne = new float3(b.NECorner, 0); var se = new float3(b.SECorner, 0); if (branches[i].IsLeaf) { Gizmos.color = Color.red; DebugBranch(tree, branches[i], branches); Gizmos.color = c; } Gizmos.DrawLine(sw, nw); Gizmos.DrawLine(nw, ne); Gizmos.DrawLine(ne, se); Gizmos.DrawLine(se, sw); } }