public override void OnInspectorGUI() { // Draws warning message for deprecated object with button for migration option MigrationTool.DrawDeprecated <BoundingBox, BoundsControlMigrationHandler>((BoundingBox)target); if (target != null) { // check if rigidbody is attached - if so show warning in case input profile is not configured for individual collider raycast BoundingBox boundingBox = (BoundingBox)target; Rigidbody rigidBody = boundingBox.GetComponent <Rigidbody>(); if (rigidBody != null) { MixedRealityInputSystemProfile profile = CoreServices.InputSystem?.InputSystemProfile; if (profile != null && profile.FocusIndividualCompoundCollider == false) { EditorGUILayout.Space(); // show warning and button to reconfigure profile EditorGUILayout.HelpBox($"When using Bounding Box in combination with Rigidbody 'Focus Individual Compound Collider' must be enabled in Input Profile.", UnityEditor.MessageType.Warning); if (GUILayout.Button($"Enable 'Focus Individual Compound Collider' in Input Profile")) { profile.FocusIndividualCompoundCollider = true; } EditorGUILayout.Space(); } } InspectorUIUtility.RenderHelpURL(target.GetType()); } DrawDefaultInspector(); }
public override void OnInspectorGUI() { // Draws warning message for deprecated object with button for migration option MigrationTool.DrawDeprecated <ManipulationHandler, ObjectManipulatorMigrationHandler>((ManipulationHandler)target); EditorGUILayout.PropertyField(hostTransform); EditorGUILayout.PropertyField(manipulationType); EditorGUILayout.PropertyField(allowFarManipulation); var handedness = (ManipulationHandler.HandMovementType)manipulationType.intValue; EditorGUILayout.Space(); GUIStyle style = EditorStyles.foldout; FontStyle previousStyle = style.fontStyle; style.fontStyle = FontStyle.Bold; oneHandedFoldout = EditorGUILayout.Foldout(oneHandedFoldout, "One Handed Manipulation", true); if (oneHandedFoldout) { if (handedness == ManipulationHandler.HandMovementType.OneHandedOnly || handedness == ManipulationHandler.HandMovementType.OneAndTwoHanded) { EditorGUILayout.PropertyField(oneHandRotationModeNear); EditorGUILayout.PropertyField(oneHandRotationModeFar); } else { EditorGUILayout.HelpBox("One handed manipulation disabled. If you wish to enable one handed manipulation select it as a Manipulation Type above.", MessageType.Info); } } EditorGUILayout.Space(); twoHandedFoldout = EditorGUILayout.Foldout(twoHandedFoldout, "Two Handed Manipulation", true); if (twoHandedFoldout) { if (handedness == ManipulationHandler.HandMovementType.TwoHandedOnly || handedness == ManipulationHandler.HandMovementType.OneAndTwoHanded) { EditorGUILayout.PropertyField(twoHandedManipulationType); } else { EditorGUILayout.HelpBox("Two handed manipulation disabled. If you wish to enable two handed manipulation select it as a Manipulation Type above.", MessageType.Info); } } var mh = (ManipulationHandler)target; var rb = mh.GetComponent <Rigidbody>(); EditorGUILayout.Space(); physicsFoldout = EditorGUILayout.Foldout(physicsFoldout, "Physics", true); if (physicsFoldout) { if (rb != null) { EditorGUILayout.PropertyField(releaseBehavior); } else { EditorGUILayout.HelpBox("Physics options disabled. If you wish to enable physics options, add a Rigidbody component to this object.", MessageType.Info); } } EditorGUILayout.Space(); constraintsFoldout = EditorGUILayout.Foldout(constraintsFoldout, "Constraints", true); if (constraintsFoldout) { EditorGUILayout.PropertyField(constraintOnRotation); EditorGUILayout.PropertyField(useLocalSpaceForConstraint); EditorGUILayout.PropertyField(constraintOnMovement); } EditorGUILayout.Space(); smoothingFoldout = EditorGUILayout.Foldout(smoothingFoldout, "Smoothing", true); if (smoothingFoldout) { EditorGUILayout.PropertyField(smoothingActive); EditorGUILayout.PropertyField(smoothingAmountOneHandManip); } EditorGUILayout.Space(); eventsFoldout = EditorGUILayout.Foldout(eventsFoldout, "Manipulation Events", true); if (eventsFoldout) { EditorGUILayout.PropertyField(onManipulationStarted); EditorGUILayout.PropertyField(onManipulationEnded); EditorGUILayout.PropertyField(onHoverEntered); EditorGUILayout.PropertyField(onHoverExited); } // reset foldouts style style.fontStyle = previousStyle; serializedObject.ApplyModifiedProperties(); }