private void Awake() { _matcher = GetComponent <RotationMatcher>(); // Grab an instance of the WearableControl singleton. This is the primary access point to the wearable SDK. _wearableControl = WearableControl.Instance; }
private void CheckAndWarnForCameraUsage(RotationMatcher matcher) { var camera = matcher.GetComponentInChildren <Camera>(); if (camera != null) { EditorGUILayout.HelpBox(CameraFoundWarning, MessageType.Warning); } }
private void Awake() { _matcher = GetComponent <RotationMatcher>(); // Grab an instance of the WearableControl singleton. This is the primary access point to the wearable SDK. _wearableControl = WearableControl.Instance; // Subscribe to DeviceConnected to handle reconnects that happen during play. _wearableControl.DeviceConnected += OnDeviceConnected; }
public override void OnInspectorGUI() { serializedObject.Update(); RotationMatcher matcher = target as RotationMatcher; CheckAndWarnForCameraUsage(matcher); EditorGUILayout.HelpBox(DescriptionBox, MessageType.None); EditorGUILayout.PropertyField(_rotationSource); EditorGUILayout.PropertyField(_updateInterval); WearableRequirement requirement = matcher.GetComponent <WearableRequirement>(); if (Application.isPlaying) { if (requirement == null || !requirement.enabled) { // Runtime, manually removed EditorGUILayout.HelpBox(RequirementRemovedOrDisabledWarning, MessageType.Warning); } } else { if (requirement == null) { // Editor, no user-provided EditorGUILayout.HelpBox(RequirementWillBeCreatedInfo, MessageType.Info); } } if (requirement != null && requirement.enabled) { // Editor, user provided OR runtime // Check sensor validity var source = (RotationMatcher.RotationSensorSource)_rotationSource.enumValueIndex; SensorId rotationSensorId = source == RotationMatcher.RotationSensorSource.SixDof ? SensorId.RotationSixDof : SensorId.RotationNineDof; if (!requirement.DeviceConfig.GetSensorConfig(rotationSensorId).isEnabled) { if (Application.isPlaying) { EditorGUILayout.HelpBox(RequiredRotationSensorManuallyDisabledWarning, MessageType.Warning); } else { EditorGUILayout.HelpBox(RequirementSensorsWillBeAlteredInfo, MessageType.Info); } } // Check rate validity var interval = (SensorUpdateInterval)_updateInterval.enumValueIndex; if (requirement.DeviceConfig.updateInterval.IsSlowerThan(interval)) { if (Application.isPlaying) { EditorGUILayout.HelpBox(RequiredUpdateIntervalManuallyLoweredWarning, MessageType.Warning); } else { EditorGUILayout.HelpBox(RequirementUpdateIntervalWillBeAlteredInfo, MessageType.Info); } } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); RotationMatcher matcher = target as RotationMatcher; CheckAndWarnForCameraUsage(matcher); EditorGUILayout.HelpBox(DESCRIPTION_BOX, MessageType.None); EditorGUILayout.PropertyField(_rotationSource); EditorGUILayout.PropertyField(_updateInterval); WearableRequirement requirement = matcher.GetComponent <WearableRequirement>(); if (Application.isPlaying) { if (requirement == null || !requirement.enabled) { // Runtime, manually removed EditorGUILayout.HelpBox(REQUIREMENT_REMOVED_OR_DISABLED_WARNING, MessageType.Warning); } } else { if (requirement == null) { // Editor, no user-provided EditorGUILayout.HelpBox(REQUIREMENT_WILL_BE_CREATED_INFO, MessageType.Info); } } if (requirement != null && requirement.enabled) { // Editor, user provided OR runtime // Check sensor validity var source = (RotationMatcher.RotationSensorSource)_rotationSource.enumValueIndex; SensorId rotationSensorId = source == RotationMatcher.RotationSensorSource.SixDof ? SensorId.RotationSixDof : SensorId.RotationNineDof; if (!requirement.DeviceConfig.GetSensorConfig(rotationSensorId).isEnabled) { if (Application.isPlaying) { EditorGUILayout.HelpBox(REQUIRED_ROTATION_SENSOR_MANUALLY_DISABLED_WARNING, MessageType.Warning); } else { EditorGUILayout.HelpBox(REQUIREMENT_SENSORS_WILL_BE_ALTERED_INFO, MessageType.Info); } } // Check rate validity var interval = (SensorUpdateInterval)_updateInterval.enumValueIndex; if (requirement.DeviceConfig.updateInterval.IsSlowerThan(interval)) { if (Application.isPlaying) { EditorGUILayout.HelpBox(REQUIRED_UPDATE_INTERVAL_MANUALLY_LOWERED_WARNING, MessageType.Warning); } else { EditorGUILayout.HelpBox(REQUIREMENT_UPDATE_INTERVAL_WILL_BE_ALTERED_INFO, MessageType.Info); } } } serializedObject.ApplyModifiedProperties(); }
private void Awake() { _matcher = GetComponent <RotationMatcher>(); _wearableControl = WearableControl.Instance; StartSensors(); }