New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Snxxz.UI; |
| | | using UnityEngine; |
| | | using UnityEditor; |
| | | |
| | | public class DeleteStar : MonoBehaviour { |
| | | |
| | | [MenuItem("Prefab/DeleteStar")] |
| | | private static void DeleteStarInPrefab() |
| | | { |
| | | string[] ids = AssetDatabase.FindAssets("t:Prefab",new string[] { "Assets/ResourcesOut/UI/PriorityWindow" }); |
| | | //string[] path = new string[ids.Length]; |
| | | for(int i=0;i<ids.Length;i++) |
| | | { |
| | | string path= AssetDatabase.GUIDToAssetPath(ids[i]); |
| | | GameObject getObj = AssetDatabase.LoadAssetAtPath<GameObject>(path); |
| | | ItemCell[] itemCellList = getObj.transform.GetComponentsInChildren<ItemCell>(true);//返回这个物体下的item对形象的item脚本数组 |
| | | if (itemCellList == null) |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var itemCell in itemCellList) |
| | | { |
| | | if (itemCell.starlist != null) |
| | | { |
| | | DestroyImmediate(itemCell.starlist, true); |
| | | EditorUtility.SetDirty(getObj); |
| | | } |
| | | } |
| | | } |
| | | AssetDatabase.SaveAssets(); |
| | | AssetDatabase.Refresh(); |
| | | //GameObject getObj = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/ResourcesOut/UI/Window/test/StarTestObj.prefab"); |
| | | } |
| | | } |