//由菜单栏调用的静态刷新数据函数
    public static void refreshAssetList()
    {
        var list = Resources.FindObjectsOfTypeAll <FduClusterAssetManager>();

        if (list != null)
        {
            foreach (FduClusterAssetManager _instance in list)
            {
                if (EditorUtility.IsPersistent(_instance.gameObject)) //第一轮 找到预制体并刷新资源
                {
                    FduAssetManagerInspector ins = (FduAssetManagerInspector)Editor.CreateEditor(_instance);
                    ins._refreshAssetList();
                    ins.serializedObject.ApplyModifiedProperties();
                    break;
                }
            }
            foreach (FduClusterAssetManager _instance in list)
            {
                if (!EditorUtility.IsPersistent(_instance.gameObject)) //第二轮 将场景中的预制体重置
                {
                    PrefabUtility.ResetToPrefabState(_instance.gameObject);
                }
            }
            EditorUtility.DisplayDialog("FduClusterToolKit", "Asset Refresh Completed", "OK");
        }
        else
        {
            EditorUtility.DisplayDialog("FduClusterToolKit", "Can not find Fdu Cluster Asset Manager!", "OK");
        }
    }
示例#2
0
 static void refreshAsset()
 {
     FduAssetManagerInspector.refreshAssetList();
 }