private void Setup() { t = transform; //This needs to be here AND in the Awake function if (renderersToSort == null || renderersToSort.Length == 0) { renderersToSort = GetComponentsInChildren <Renderer>(); } IsoSpriteSortingManager.RegisterSprite(this); }
private void Setup() { t = transform; if (renderersToSort == null || renderersToSort.Length == 0) { renderersToSort = new Renderer[] { GetComponent <Renderer>() }; } if (!isMovable) { cachedBounds = new Bounds2D(renderersToSort[0].bounds); } System.Array.Sort(renderersToSort, (a, b) => a.sortingOrder.CompareTo(b.sortingOrder)); IsoSpriteSortingManager.RegisterSprite(this); }
public void Register() { IsoSpriteSortingManager.RegisterSprite(this); }