void RemoveScripts() { TileTool2DLayerDepthSort t = (TileTool2DLayerDepthSort)target; for (int i = 0; i < t.transform.childCount; i++) { Transform c = t.transform.GetChild(i); Undo.DestroyObjectImmediate(c.gameObject.GetComponent <TileTool2DDepthSort>()); } }
void SortAll() { TileTool2DLayerDepthSort t = (TileTool2DLayerDepthSort)target; for (int i = 0; i < t.transform.childCount; i++) { Transform c = t.transform.GetChild(i); TileTool2DDepthSort s = c.gameObject.GetComponent <TileTool2DDepthSort>(); s.lastPos = 999999999; s.CacheComponents(); s.SetSortingOrder(); EditorUtility.SetDirty(s.cacheSpriteRenderer); } SceneView.RepaintAll(); }
void ResetScatterAll() { TileTool2DLayerDepthSort t = (TileTool2DLayerDepthSort)target; t.AddSortToChildren(); for (int i = 0; i < t.transform.childCount; i++) { Transform c = t.transform.GetChild(i); TileTool2DDepthSort s = c.gameObject.GetComponent <TileTool2DDepthSort>(); if (s.resetPosition != Vector3.zero) { s.transform.position = s.resetPosition; } s.resetPosition = Vector3.zero; EditorUtility.SetDirty(s.transform); } }
void AddScripts() { TileTool2DLayerDepthSort t = (TileTool2DLayerDepthSort)target; t.AddSortToChildren(); }