public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { // If this is not a MiddleVR package import, skip bool importingMvrDll = false; foreach (string s in importedAssets) { // MiddleVR_Unity3D.dll should be imported only at package import if (s.Contains("MiddleVR_Unity3D.dll")) { importingMvrDll = true; break; } } if (!importingMvrDll) { return; } Debug.Log("[ ] Package import post process: import GUI web assets from Program Files..."); // Copy web assets from MiddleVR installation folders // Find MiddleVR installation folder from Path environment variable string mvrDllPath = FileSystemTools.FindFileInPath("MiddleVR.dll"); if (mvrDllPath == "") { EditorUtility.DisplayDialog("MiddleVR package import error", "MiddleVR installation folder was not found\nDid you install MiddleVR on this computer and did you restart after MiddleVR installation?\nYou should restart and re-import the MiddleVR Unity package.", "Ok"); return; } // Replace the dll path by the menu path char separator = System.IO.Path.DirectorySeparatorChar; int lastPathSeparatorPos = mvrDllPath.LastIndexOf(separator); mvrDllPath = mvrDllPath.Remove(lastPathSeparatorPos); lastPathSeparatorPos = mvrDllPath.LastIndexOf(separator); mvrDllPath = mvrDllPath.Remove(lastPathSeparatorPos); string webAssetsPathSource = mvrDllPath + separator + "data" + separator + "GUI" + separator + "Menu"; string webAssetsPathDestination = Application.dataPath + "/MiddleVR/.WebAssets/VRMenu"; Debug.Log("[ ] Trying to copy folder '" + webAssetsPathSource + "' to " + webAssetsPathDestination + "'..."); // If destination already exists, update it if (System.IO.Directory.Exists(webAssetsPathDestination)) { Debug.Log("[ ] Destination folder '" + webAssetsPathDestination + "' already exists, updating it..."); } if (System.IO.Directory.Exists(webAssetsPathSource)) { FileSystemTools.DirectoryCopy(webAssetsPathSource, webAssetsPathDestination, true, true); } else { EditorUtility.DisplayDialog("MiddleVR package import error", "Web assets folder was not found:\n'" + webAssetsPathSource + "'\nYou should manually copy the content of the folder '/data/GUI/Menu' from your MiddleVR installation location to:\n'" + webAssetsPathDestination + "'", "Ok"); } if (!System.IO.File.Exists(Application.dataPath + "/MiddleVR_Source_Project.txt")) { // Clean old deprecated files from previous MiddleVR versions string[] filesToDelete = { "/Editor/VRCustomEditor.cs", "/Resources/OVRLensCorrectionMat.mat", "/MiddleVR/Scripts/Internal/VRCameraCB.cs", "/MiddleVR/Assets/Materials/WandRayMaterial.mat" }; foreach (string fileToDelete in filesToDelete) { string filePath = Application.dataPath + fileToDelete; if (System.IO.File.Exists(filePath)) { Debug.Log("[ ] Package import post process: clean deprecated MiddleVR files. Deleting file '" + filePath + "'."); System.IO.File.Delete(filePath); } } } Debug.Log("[ ] Package import post process: End."); }