24 private const string CameraPrefabGUID =
"d29bc40b7f3df26479d6a0aac211c355";
30 private const string InputSystemPrefabGUID =
"3eddd1c29199313478dd3f912bfab2ab";
36 private const string DefaultCursorPrefabGUID =
"a611e772ef8ddf64d8106a9cbb70f31c";
42 private const string SpatialMappingPrefabGUID =
"2ed75ffdf9031c94e8bce4b3d17b9928";
48 AddMixedRealityCamera,
56 #endregion // Nested Types 58 #region Overrides / Event Handlers 69 PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GUIDToAssetPath(CameraPrefabGUID)));
77 if (mainCamera == null)
79 Debug.LogWarning(
"Could not find a valid \"MainCamera\"! Unable to update camera position.");
83 mainCamera.transform.position = Vector3.zero;
89 var inputManager = FindObjectOfType<InputManager>();
90 if (inputManager != null)
92 DestroyImmediate(inputManager.gameObject);
95 var eventSystems = FindObjectsOfType<EventSystem>();
96 foreach (var eventSystem
in eventSystems)
98 DestroyImmediate(eventSystem.gameObject);
101 var inputModules = FindObjectsOfType<StandaloneInputModule>();
102 foreach (var inputModule
in inputModules)
104 DestroyImmediate(inputModule.gameObject);
107 PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GUIDToAssetPath(InputSystemPrefabGUID)));
113 var focusManager = FindObjectOfType<FocusManager>();
114 if (focusManager != null)
119 var sceneCanvases = Resources.FindObjectsOfTypeAll<Canvas>();
120 foreach (Canvas canvas
in sceneCanvases)
129 var cursors = FindObjectsOfType<Cursor>();
130 foreach (var cursor
in cursors)
132 DestroyImmediate(cursor.gameObject.GetParentRoot());
135 PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GUIDToAssetPath(DefaultCursorPrefabGUID)));
137 FindObjectOfType<InputManager>().GetComponent<SimpleSinglePointerSelector>().Cursor = FindObjectOfType<Cursor>();
142 var spatialMappingManagers = FindObjectsOfType<SpatialMappingManager>();
143 if (spatialMappingManagers.Length > 0)
145 Debug.LogWarning(
"There's already a SpatialMappingManager in the scene. Did not add the SpatialMapping prefab.");
149 PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GUIDToAssetPath(SpatialMappingPrefabGUID)));
153 EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
160 for (
int i = 0; i <= (int)
SceneSetting.UpdateCanvases; i++)
174 Names[
SceneSetting.AddMixedRealityCamera] =
"Add the Mixed Reality Camera Prefab";
177 "Adds the Mixed Reality Camera Prefab to the scene.\n\n" +
178 "The prefab comes preset with all the components and options for automatically handling Occluded and Transparent Mixed Reality Applications.";
180 Names[
SceneSetting.CameraToOrigin] =
"Move Camera to Origin";
183 "Moves the main camera to the world origin of the scene (0, 0, 0).\n\n" +
184 "<color=#ffff00ff><b>Note:</b></color> When a Mixed Reality application starts, the users head is the center of the world. By not having your Main Camera centered at " +
185 "the world origin (0, 0, 0) will result in GameObjects not appearing where they are expected. This option should remain checked unless you have alternative methods " +
186 "that explicitly deal with any apparent offset.";
188 Names[
SceneSetting.AddInputSystem] =
"Add the Input Manager Prefab";
191 "Adds the Input Manager Prefab to the scene.\n\n" +
192 "The prefab comes preset with all the components and options for automatically handling input for Mixed Reality Applications.\n\n" +
193 "<color=#ff0000ff><b>Warning!</b></color> This will remove and replace any currently existing Input Managers or Event Systems in your scene.";
195 Names[
SceneSetting.AddDefaultCursor] =
"Add the Default Cursor Prefab";
198 "Adds the Default Cursor Prefab to the scene.\n\n" +
199 "The prefab comes preset with all the components and options for automatically handling cursor animations for Mixed Reality Applications.\n\n" +
200 "<color=#ff0000ff><b>Warning!</b></color> This will remove and replace any currently existing Cursors in your scene.";
202 Names[
SceneSetting.UpdateCanvases] =
"Update World Space Canvases";
205 "Updates all the World Space Canvases in the scene to use the Focus Managers UIRaycastCamera as its default event camera.\n\n" +
206 "<color=#ffff00ff><b>Note:</b></color> This also adds a CanvasHelper script to the canvas to aid in the scene transitions and instances where the camera does not " +
207 "initially exist in the same scene as the canvas.";
209 Names[
SceneSetting.AddSpatialMapping] =
"Add the Spatial Mapping Prefab";
211 "Adds the Spatial Mapping Prefab to the scene.\n\n" +
212 "The prefab comes preset with the components and options for bringing spatial mapping into your HoloLens application.\n\n" +
213 "<color=#ff0000ff><b>Warning!</b></color> This will remove and replace any currently existing Spatial Mapping Managers in your scene.";
220 minSize =
new Vector2(350, 250);
223 #endregion // Overrides / Event Handlers