private static void CleanUpSelection() { string _path = Application.dataPath; string[] _files = Directory.GetFiles(Application.dataPath, "*.prefab", SearchOption.AllDirectories); List <GameObject> _objs = new List <GameObject>(); for (int i = 0; i < _files.Length; i++) { string _one = "Assets" + Utility.MakeUnifiedDirectory(_files[i]).Replace(Application.dataPath, string.Empty); _objs.Add(AssetDatabase.LoadAssetAtPath <GameObject>(_one)); } for (int i = 0; i < _objs.Count; ++i) { EditorUtility.DisplayProgressBar("Checking", _objs[i].name, (float)i / (float)_objs.Count); GameObject _gameObject = _objs[i] as GameObject; GameObject[] _gs = UtilityUnity.GetAllChild(_gameObject); for (int j = 0; j < _gs.Length; j++) { CleanUpAsset(_gs[j]); } AssetDatabase.SaveAssets(); } EditorUtility.ClearProgressBar(); AssetDatabase.Refresh(); }
public void Refresh() { GameObject[] _gs = UtilityUnity.GetAllChild(this.gameObject); Renderer _render = null; for (int i = 0; i < _gs.Length; i++) { _render = _gs[i].GetComponent <Renderer>(); if (_render) { if (relyon != UILayers.Base) { _render.sortingOrder = (int)relyon + order; } else { _render.sortingOrder = order; } } } }