private void ShowDecoratorsControls() { var decorators = _controller.Decorators; if (PlayerSettings.defaultInterfaceOrientation == UIOrientation.AutoRotation) { EditorGUI.BeginDisabledGroup(true); } UndoableInputFieldUtils.BoolFieldWithTooltip(() => decorators.ParallaxAutoRotation, v => { decorators.ParallaxAutoRotation = v; #if UNITY_EDITOR && UNITY_ANDROID if (PlayerSettings.defaultInterfaceOrientation == UIOrientation.AutoRotation && v) { this.Warning(EnabledParallaxWarning); } #endif } , ParallaxFieldLabel, "Only accessible when Player Settings -> Android -> Resolution and presentation -> Default orientation is not AutoRotation", _controller.Settings); if (PlayerSettings.defaultInterfaceOrientation == UIOrientation.AutoRotation) { EditorGUI.EndDisabledGroup(); } if (Application.isPlaying) { EditorGUI.BeginDisabledGroup(true); } UndoableInputFieldUtils.BoolFieldWithTooltip(() => decorators.AlphaBlending, v => decorators.AlphaBlending = v, AlphaBlendingLabel, alphaBlendingTooltip, _controller.Settings); if (Application.isPlaying) { EditorGUI.EndDisabledGroup(); } // Edit > Project Settings > Player settings > Other > Scripting define symbols #if LEIA_ADVANCED_USER // for ShowTiles param on LeiaDisplay decorator // setting does not persist between runs if (Application.isEditor && Application.isPlaying) { UndoableInputFieldUtils.BoolField(() => _controller.Decorators.ShowTiles, (bool b) => { decorators.ShowTiles = b; _controller.IsDirty = true; }, ShowTilesFieldLabel); } #endif _controller.Decorators = decorators; }
private void ShowLookAtTarget() { bool lookAt = _controller.LookAtTarget; UndoableInputFieldUtils.BoolField(() => lookAt, v => { _controller.LookAtTarget = v; }, "Look at Target"); }
public override void OnInspectorGUI() { if (_controller == null) { _controller = (LeiaCamera)target; } if (!_controller.enabled) { return; } EditorGUI.BeginChangeCheck(); // allow multi-object editing // display object properties in sequence when multiple objects selected for (int i = 0; i < targets.Length; i++) { _controller = (LeiaCamera)targets[i]; if (targets.Length > 1) { EditorGUILayout.Separator(); EditorGUILayout.ObjectField(_controller, typeof(LeiaCamera), true); } UndoableInputFieldUtils.ImmediateFloatField(() => _controller.ConvergenceDistance, v => _controller.ConvergenceDistance = v, ConvergenceDistanceFieldLabel, _controller); UndoableInputFieldUtils.ImmediateFloatField(() => _controller.BaselineScaling, v => _controller.BaselineScaling = v, BaselineScalingFieldLabel, _controller); UndoableInputFieldUtils.BoolField(() => _controller.DrawCameraBounds, v => _controller.DrawCameraBounds = v, DrawCameraBoundsFieldLabel, _controller); EditorGUILayout.Separator(); if (EditorApplication.isPlaying) { if (!LeiaDisplay.InstanceIsNull) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(UpdateEffectsButtonLabel)) { _controller.UpdateEffects(); } EditorGUILayout.HelpBox(UpdateEffectsHelpText, MessageType.Info); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.HelpBox(NoEffectsControllerHelpText, MessageType.Info); } } if (targets.Length > 1) { EditorGUILayout.Separator(); } } if (EditorGUI.EndChangeCheck()) { foreach (Object obj in targets) { EditorUtility.SetDirty(obj); } } }