public override void OnInspectorGUI() { this.serializedObject.Update(); MPUSeries controller = (MPUSeries)target; GUI.enabled = false; EditorGUILayout.PropertyField(script, true, new GUILayoutOption[0]); GUI.enabled = true; foldout = EditorGUILayout.Foldout(foldout, "Sketch Options"); if (foldout == true) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(id, new GUIContent("id")); EditorGUILayout.PropertyField(model, new GUIContent("model")); EditorGUILayout.PropertyField(secondary, new GUIContent("secondary")); EditorGUILayout.PropertyField(forward, new GUIContent("forward")); EditorGUILayout.PropertyField(up, new GUIContent("up")); EditorGUI.indentLevel--; } controller.enableUpdate = EditorGUILayout.Toggle("Enable update", controller.enableUpdate); foldout2 = EditorGUILayout.Foldout(foldout2, "Events"); if (foldout2 == true) { EditorGUILayout.PropertyField(OnStartCalibration, new GUIContent("OnStartCalibration")); EditorGUILayout.PropertyField(OnCalibrated, new GUIContent("OnCalibrated")); } if (Application.isPlaying) { if (controller.connected) { if (controller.calibrating) { EditorGUILayout.HelpBox("Now MPU is calibrating...\nPlease, lay down the device on the flat surface.", MessageType.Info); } else { if (GUILayout.Button("Calibration")) { controller.Calibration(); } } } EditorUtility.SetDirty(target); } this.serializedObject.ApplyModifiedProperties(); }
public void MPUCalibration() { mpu.Calibration(); }