Ejemplo n.º 1
0
    static public void ReplaceInternalAssets()
    {
        var res = EditorUtility.DisplayDialog("Warning", "Are you sure you realy want to do that ? ", "OK", "Cancle");

        if (!res)
        {
            return;
        }
        var tool = new ReplaceInternalAssetTool();

        // replace other asset to use replaced assets
        tool.ReplaceInternalAssetToBuildInAsset("Data", "InternalAssets", "");

        Refresh();
    }
Ejemplo n.º 2
0
    static void ReplaceInternalAssetsWithCleanup()
    {
        var res = EditorUtility.DisplayDialog("Warning", "Are you sure you realy want to do that ? ", "OK", "Cancle");

        if (!res)
        {
            return;
        }
        var internalAssetsExportPath = "InternalAssets";

        if (Directory.Exists(Application.dataPath + "/" + internalAssetsExportPath))
        {
            Directory.Delete(Application.dataPath + "/" + internalAssetsExportPath, true);
        }
        Directory.CreateDirectory(Application.dataPath + "/" + internalAssetsExportPath);
        // copy build in shader to target folder
        var subpath = Application.dataPath.Substring(0, Application.dataPath.IndexOf("Assets")) + internalAssetsExportPath;

        CopyFileOrDirectory(subpath + "/", Application.dataPath + "/" + internalAssetsExportPath + "/");

        // refresh and reload
        Refresh();

        // export default material to datapath
        InternalAssetsExportTool ExportTool = new InternalAssetsExportTool();

        ExportTool.ExportInternalAsset("InternalAssets");

        Refresh();

        ReplaceInternalAssetTool tool = new ReplaceInternalAssetTool();

        // replace default mat to use
        tool.ReplaceInternalAssetToBuildInAsset("InternalAssets", "InternalAssets", "");

        Refresh();

        tool = new ReplaceInternalAssetTool();
        // replace other asset to use replaced assets
        tool.ReplaceInternalAssetToBuildInAsset("Data", "InternalAssets", "");

        Refresh();
    }