/// <summary> /// Creates GUI elements for fields specific to the slider joint. /// </summary> protected void BuildGUI(SliderJoint joint) { enableLimitField.OnChanged += x => { joint.SetFlag(SliderJointFlag.Limit, x); MarkAsModified(); ConfirmModify(); ToggleLimitFields(x); }; Layout.AddElement(enableLimitField); limitLayout = Layout.AddLayoutX(); { limitLayout.AddSpace(10); GUILayoutY limitContentsLayout = limitLayout.AddLayoutY(); limitGUI = new LimitLinearRangeGUI(joint.Limit, limitContentsLayout, Persistent); limitGUI.OnChanged += (x, y) => { joint.Limit = x; joint.Limit.SetBase(y); MarkAsModified(); }; limitGUI.OnConfirmed += ConfirmModify; } ToggleLimitFields(joint.HasFlag(SliderJointFlag.Limit)); base.BuildGUI(joint, true); }
/// <inheritdoc/> protected internal override void Initialize() { SliderJoint joint = (SliderJoint)InspectedObject; BuildGUI(joint, true); drawer.AddDefault(joint, typeof(SliderJoint)); drawer.AddField("Enable limit", () => joint.HasFlag(SliderJointFlag.Limit), x => joint.SetFlag(SliderJointFlag.Limit, x)); drawer.AddConditional("Limit", () => joint.HasFlag(SliderJointFlag.Limit)); }