Documentation for the Unity C# Library
Loading...
Searching...
No Matches
PixoVREditorCommands.cs
Go to the documentation of this file.
1#if UNITY_EDITOR
2using System.IO;
3using UnityEditor;
4using UnityEngine;
5
6public static class PixoVREditorCommands
7{
8 [MenuItem("PixoVR/Setup")]
9 public static void PixoVRPluginSetup()
10 {
11 string pluginPath = FindPluginPath();
12 string destinationManifestPath = Path.Combine(pluginPath, "Plugins/Android/AndroidManifest.xml");
13 string destinationJavaUtilsPath = Path.Combine(pluginPath, "Plugins/Android/PixoUtils.java");
14 string sourceManifestPath = "";
15 string sourceJavaUtilsPath = "";
16#if UNITY_6000_0_OR_NEWER
17 sourceManifestPath = Path.Combine(pluginPath, "Editor/Others/AndroidManifest_Game.xml");
18 sourceJavaUtilsPath = Path.Combine(pluginPath, "Editor/Others/PixoUtils_Game.java");
19#else
20 sourceManifestPath = Path.Combine(pluginPath, "Editor/Others/AndroidManifest_Main.xml");
21 sourceJavaUtilsPath = Path.Combine(pluginPath, "Editor/Others/PixoUtils_Main.java");
22#endif
23 File.Copy(sourceManifestPath, destinationManifestPath, true);
24 File.Copy(sourceJavaUtilsPath, destinationJavaUtilsPath, true);
25 AssetDatabase.Refresh();
26 }
27
28 private static string FindPluginPath()
29 {
30 string[] guids = AssetDatabase.FindAssets("PixoVRPreBuilder t:Script");
31 if (guids.Length > 0)
32 {
33 string path = AssetDatabase.GUIDToAssetPath(guids[0]);
34 string[] pathParts = path.Split("/");
35 path = Path.Combine(pathParts[0], pathParts[1]);
36 Debug.Log("Prebuild Script path: " + path);
37 return path;
38 }
39
40 return null;
41 }
42}
43#endif