using System.Collections.Generic; using UnityEngine; public class OutlineGlowRendererSort : IComparer { public int Compare(OutlineGlowRenderer x, OutlineGlowRenderer y) { Vector3 position; try { position = Camera.current.transform.position; } catch { Debug.Log("Couldn't find current camera!"); return 0; } float magnitude = (x.transform.position - position).magnitude; float magnitude2 = (y.transform.position - position).magnitude; if (magnitude > magnitude2) { return -1; } return 1; } }