public override void OnInspectorGUI() { base.OnInspectorGUI(); if (!HandPreviewManager.IsPreviewModeEnable) { if (GUILayout.Button("Enter Preview Mode Right Hand")) { EnterPreviewMode(VR_Manager.instance.RightController); } if (GUILayout.Button("Enter Preview Mode Left Hand")) { EnterPreviewMode(VR_Manager.instance.LeftController); } } else { if (GUILayout.Button("Save and Exit Preview Mode")) { HandPreviewManager.SaveAndExit(); } if (GUILayout.Button("Exit Preview Mode")) { HandPreviewManager.ExitPreviewMode(); } } }
private void EnterPreviewMode(VR_Controller controller) { targetScript = (HandVisualizerTool)target; grabbable = targetScript.GetComponent <VR_Grabbable>(); grabbable.gameObject.AddComponent <GameObjectMarker>(); EditorSceneManager.MarkAllScenesDirty(); EditorSceneManager.SaveOpenScenes(); grabbableClone = Instantiate(grabbable, grabbable.transform.position, grabbable.transform.rotation); activeController = Instantiate(controller, grabbable.RightInteractPoint.position, Quaternion.identity); grabbableClone.SetEditorGrabPositionAndRotation(activeController); HandPreviewManager.EnterPreviewMode(grabbableClone.transform.root.gameObject); }