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(); }
static void UnpackInternalAssets() { var res = EditorUtility.DisplayDialog("Warning", "Are you sure you realy want to do that ? ", "OK", "Cancle"); if (!res) { return; } InternalAssetsExportTool tool = new InternalAssetsExportTool(); tool.ExportInternalAsset("InternalAssets"); //AssetInfo info = new AssetInfo("E:\\Project\\unityProjcet\\ABPacker\\Assets\\Art\\tmp 1.mat"); //var assets = EditorUtility.CollectDependencies(new Object[] { AssetDatabase.LoadMainAssetAtPath(info.GetRelativePath()) }); //foreach (var asset in assets) //{ // Debug.Log(AssetDatabase.GetAssetPath(asset) + '/' + asset.name); //} //var deps = AssetDatabase.GetDependencies(info.GetRelativePath()); //foreach (var asset in deps) //{ // Debug.Log(asset); //} }