Exemplo n.º 1
0
    public static void cleanShardAssets(UnityEngine.Object obj)
    {
        CLSharedAssets sharedAsset = null;
        CLRoleAvata    avata       = null;

        if (obj is GameObject)
        {
            sharedAsset = ((GameObject)obj).GetComponent <CLSharedAssets> ();
            avata       = ((GameObject)obj).GetComponent <CLRoleAvata> ();
            if (AssetDatabase.GetAssetPath(obj).Contains("/other/model/"))
            {
                ECLEditorUtl.cleanModleMaterials(AssetDatabase.GetAssetPath(obj));
            }
            UIFont font = ((GameObject)obj).GetComponent <UIFont> ();
            if (font != null)
            {
                string spName = font.spriteName;
                font.atlas      = null;
                font.material   = null;
                font.spriteName = spName;
            }
        }
        else if (obj is Material)
        {
            CLMaterialPool.cleanTexRef(ECLEditorUtl.getAssetName4Upgrade(obj), (Material)obj);
            sharedAsset = null;
        }
        else
        {
            sharedAsset = null;
        }
        bool isRefresh = false;

        if (avata != null)
        {
            avata.cleanMaterial();
            isRefresh = true;
        }
        if (sharedAsset != null)
        {
            sharedAsset.cleanRefAssets();
            isRefresh = true;
        }
        if (isRefresh && obj is GameObject)
        {
            //			AssetDatabase.Refresh ();
            //string path = AssetDatabase.GetAssetPath (obj);
            //EditorUtility.SetDirty (obj);
            //AssetDatabase.WriteImportSettingsIfDirty (path);
            //AssetDatabase.ImportAsset (path);
            PrefabUtility.SavePrefabAsset(obj as GameObject);
        }
    }
Exemplo n.º 2
0
 public void cleanMaterialInfor()
 {
     instance.cleanRefAssets();
 }