Lean GUI is an extension to Unity's UI system, adding many useful components.
The new components are also designed to be very flexible, so you can combine them in any way you like.
Simply go through all the demo scenes in the Lean/GUI/Examples folder!
Most of the demo scenes introduce one new feature at a time, allowing you to clearly understand what is being done.
The description at the bottom also tells you in detail which components or settings were added/changed to achieve the effects seen.
To understand what a specific component setting does, just hover your mouse over it to see the tooltip. You can also click the documentation button at the top right of the component.
Here's a list of all my other assets, please check them out!
You can also view this list on my Asset Store page.
Rapidly develop your game with consistent input across desktop & mobile using Lean Touch. This lightweight asset comes with many modular components, allowing you to customize them to your exact project needs!
Lean Touch+ is an extension to the popular Lean Touch asset, adding many more example scenes.
Lean Localization is a localization library that's designed to be as simple to use as possible for both designers, and programmers.
Quickly optimize the performance of your games using Lean Pool. Within minutes you can use this lightweight asset to preload, recycle, and limit the spawning of your prefabs.
Quickly polish your games using Lean Transition. This asset allows you to easily tween or animate almost anything in your game, making it transition smoothly.
Lean GUI is a colllection of components that extend Unity's GUI system, allowing you to rapidly enhance the user experience (UX) of your game's UI.
Lean GUI Shapes allows you to quickly add lines, rounded boxes, polygons, and much more to your GUI!
Lean Texture allows you quickly modify textures in your project with a range of filters, pack them together into channels, and much more!
Lean Texture+ is an extension to Lean Texture, adding many new types of texture modification tools!
Paint all your objects using Paint in 3D - both in game, and in editor. All features are optimized with GPU accelerated texture painting, so you can enjoy consistent performance, even if you paint your objects one million times!
FLOW allows you to add large scale interactive fluids to your scene - all highly optimized using GPU acceleration.
Unlock the full potential of your 2D games using Destructible 2D, this asset allows you to quickly convert all your boring solid sprites into fully destructible ones!
Quickly make the space scene of your dreams using Space Graphics Toolkit. This huge collection of space effects can be customized and combined in any way you like, allowing you to quickly make realistic or fantasy worlds. Each feature has been heavily optimized to run on almost any device and platform.
Enhance your space scenes using this large pack of high detail volumetric planets. These planets are finished using the powerful planet features from Space Graphics Toolkit (not required).
Unity sounds only emanate from a single point source. This is great for explosions and footsteps, but quite often you need something more advanced. Volumetric Audio is an easy to use package that allows you to define boxes, spheres, capsules, paths, or meshes that sounds can emanate from.
Updated common library code.
Added LeanButton.Required setting.
Added LeanJoystick.CenterOnRelease setting.
Fixed LeanChaseRigidbody.Linear setting.
Fixed LeanTooltip.Boundary = Pivot setting when the tooltip exceeds the screen size when flipped.
Renamed LeanTooltip.Boundary = Position to ShiftPosition.
Renamed LeanTooltip.Boundary = Pivot to FlipPivot.
Moved main build to Unity 2019.4.12f1.
Added Non/Interactable events and transitions to LeanButton.
Added Non/Interactable events and transitions to LeanDrag.
Added Non/Interactable events and transitions to LeanResize.
Added Non/Interactable events and transitions to LeanJoystick.
Added LeanSnap.Position value.
Added LeanSnap.OnPositionChanged event.
Added LeanSnapEvent component.
Added LeanTooltip.Move setting.
Improved Tooltip demo scenes.
Added Swipe Screens demo scene.
Added LeanSnap.HorizontalIntervalRect setting.
Added LeanSnap.VerticalIntervalRect setting.
Added LeanSnap.HorizontalIntervalParent setting.
Added LeanSnap.VerticalIntervalParent setting.
Added LeanConstrainAnchoredPosition.HorizontalRectMin/Max settings.
Added LeanConstrainAnchoredPosition.HorizontalParentMin/Max settings.
Added all legacy transition options back to LeanButton.
Added all legacy transition options back to LeanJoystick.
Added all legacy transition options back to LeanResize.
Added all legacy transition options back to LeanDrag.
Moved main build to Unity 2018.4.13f1.
Added LeanMoveToTop.Move setting.
Added LeanConstrainToParent.Horizontal setting.
Added LeanConstrainToParent.Vertical setting.
Added LeanConstrainAnchoredPosition component.
Moved main build to Unity 2018.4.0f1.
Updated documentation.
Added asmdef.
Fixed LeanJoystick bug with screen space camera UI.
Added LeanConstrainToParent component.
Added Constrain demo scene.
Fixed LeanDrag when using rotated elements.
Fixed inspector expand buttons in UI Elements.
Fixed LeanSwipe.SwipeTransitions not being called.
Fixed LeanTooltip.OnHide not being called.
Updated Common library code.
Updated demo scene design.
Fixed LeanJoystick.OnDown event.
Fixed LeanJoystick.OnUp event.
Improved all component tooltips and comments.
Included LeanTransition again.
Added Horizontal + Vertical joysticks to "14 Joystick" demo scene.
This component provides an alternative to Unity's UI button, allowing you to easily add custom transitions, as well as add an OnDown event.
Which buttons should this component react to?
If you enable this then OnDown + DownTransition be invoked once for each finger that begins touching the button.
If you disable this then OnDown + DownTransition will only be invoked for the first finger that begins touching the button.
If your finger presses down on the button and drags more than this many pixels, then selection will be canceled.
-1 = Unlimited drag distance.
0 = Until the finger exits the button graphic.
This allows you to perform a transition when there are no longer any fingers touching the button.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color back to normal.
This allows you to perform a transition when a finger begins touching the button.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when you click or tap on this button.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Play Sound Transition (LeanPlaySound) component can be used to play a click sound.
This allows you to perform an action when a finger begins touching the button.
This allows you to perform an action when you click or tap on this button.
This component will automatically constrain the current RectTransform.anchoredPosition to the specified range.
Constrain horizontally?
The minimum value in pixels.
The maximum value in pixels.
The minimum value in 0..1 percent of the current RectTransform size.
The maximum value in 0..1 percent of the current RectTransform size.
The minimum value in 0..1 percent of the parent RectTransform size.
The maximum value in 0..1 percent of the parent RectTransform size.
Constrain vertically?
The minimum value in pixels.
The maximum value in pixels.
The minimum value in 0..1 percent of the current RectTransform size.
The maximum value in 0..1 percent of the current RectTransform size.
The minimum value in 0..1 percent of the parent RectTransform size.
The maximum value in 0..1 percent of the parent RectTransform size.
This tells you the minimum and maximum values of the current RectTransform based on this component's horizontal anchor settings.
This tells you the minimum and maximum values of the current RectTransform based on this component's vertical anchor settings.
This component will automatically constrain the current RectTransform to its parent.
Constrain horizontally?
Constrain vertically?
This component allows you to drag the specified RectTransform when you drag on this UI element.
If you want a different RectTransform to be moved while dragging on this UI element, then specify it here. This allows you to turn the current UI element into a drag handle.
Should you be able to drag horizontally?
Should you be able to drag vertically?
This allows you to perform a transition when this element begins being dragged.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when this element ends being dragged.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform an actions when this element begins being dragged.
This allows you to perform an actions when this element ends being dragged.
This will return true if the mouse/finger is currently dragging this UI element.
This class contains useful data specific to Lean GUI.
This will return all the RaycastResults under the specified screen point using the specified layerMask.
This component allows you to change a UI element's hitbox to use its graphic Image opacity/alpha.
The alpha threshold specifies the minimum alpha a pixel must have for the event to be considered a "hit" on the Image.
This component allows you to perform an action as long as the mouse is hovering over the current UI element, or a finger is on top.
Enable this if you want EnterTransitions + OnEnter to be invoked once for each mouse/finger that enters this element.
Enable this if you want ExitTransitions + OnExit to be invoked once for each mouse/finger that exits this element.
This allows you to perform a transition when the mouse/finger enters this UI element.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when the mouse/finger exits this UI element.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform an action when the mouse/finger enters this UI element.
This allows you to perform an action when the mouse/finger exits this UI element.
This component turns the current UI element into a joystick.
This allows you to control the shape of the joystick movement.
Box = -Size to +Size on x and y axes.
Circle = Within Radius on x and y axes.
This allows you to control the size of the joystick handle movement across the x and y axes.
The allows you to control the maximum distance the joystick handle can move across the x and y axes.
If you want to see where the joystick handle is, then make a child UI element, and set its RectTransform here.
This allows you to control how quickly the joystick handle position updates
-1 = instant.
If you only want the smooth Dampening to apply when the joystick is returning to the center, then you can enable this.
By default, the joystick will be placed relative to the center of this UI element.
If you enable this, then the joystick will be placed relative to the place you first touch this UI element.
When the mouse/finger releases from the joystick, should the joystick value reset to the center, or stay where it is?
If you want to show the boundary of the joystick relative to the origin, then you can make a new child GameObject graphic, and set its RectTransform here.
The -1..1 x/y position of the joystick relative to the Size or Radius.
This allows you to perform a transition when a finger begins touching the joystick.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when a finger stops touching the joystick.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform an action when a finger begins touching the joystick.
This event is invoked each frame with the ScaledValue.
This allows you to perform an action when a finger stops touching the joystick.
This component will automatically move the specified transform to be the first sibling when you press down on this UI element.
This allows you to choose which component to perform the action on.
ThisTransform = transform.SetAsLastSibling().
TargetTransform = Target.SetAsLastSibling().
ParentComponents = Invoke all LeanMoveToTop ancestor components.
If you want a different transform to be moved when pressing down on this UI element, then specify it here.
None = The current GameObject's transform.
This component allows you make a UI element based on the current device orientation.
Should the RectTransform.anchoredPosition setting change based on device orientation?
The RectTransform.anchoredPosition value when in landscape mode.
The RectTransform.anchoredPosition value when in portrait mode.
Should the RectTransform.sizeDelta setting change based on device orientation?
The RectTransform.sizeDelta value when in landscape mode.
The RectTransform.sizeDelta value when in portrait mode.
Should the RectTransform.anchorMin setting change based on device orientation?
The RectTransform.anchorMin value when in landscape mode.
The RectTransform.anchorMin value when in portrait mode.
Should the RectTransform.anchorMax setting change based on device orientation?
The RectTransform.anchorMax value when in landscape mode.
The RectTransform.anchorMax value when in portrait mode.
Should the RectTransform.offsetMin setting change based on device orientation?
The RectTransform.offsetMin value when in landscape mode.
The RectTransform.offsetMin value when in portrait mode.
Should the RectTransform.offsetMax setting change based on device orientation?
The RectTransform.offsetMax value when in landscape mode.
The RectTransform.offsetMax value when in portrait mode.
Should the RectTransform.pivot setting change based on device orientation?
The RectTransform.pivot value when in landscape mode.
The RectTransform.pivot value when in portrait mode.
Should the RectTransform.localRotation setting change based on device orientation?
The RectTransform.localRotation value when in landscape mode.
The RectTransform.localRotation value when in portrait mode.
Should the RectTransform.localScale setting change based on device orientation?
The RectTransform.localScale value when in landscape mode.
The RectTransform.localScale value when in portrait mode.
This allows you to perform a transition when the orientation changes to landscape.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when the orientation changes to portrait.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This event will be invoked when the orientation changes to landscape.
This event will be invoked when the orientation changes to portrait.
This will copy the current RectTransform settings to the Landscape settings.
This will copy the current RectTransform settings to the Portrait settings.
This forces the orientation to update now.
This component allows you to trigger a transition and/or event at regular intervals.
This stores all active and enabled LeanPulse instances, so you can manually pulse them by name from anywhere.
This tells you how many pulses remain until this component stops.
-1 = unlimited
When this reaches 0, and RemainingPulses is not 0, this component will pulse.
This allows you to control the amount of seconds between each pulse.
-1 = Manual Pulses Only
This allows you to choose where in the game loop this pulse will update.
This allows you to perform an animation when this UI element pulses.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the LeanPlaySound (Play Sound Transition) component can be used to play a pulse sound.
This allows you to perform an action when this UI element pulses.
int = RemainingPulses
This will pulse, as long as you have remaining pulses.
This allows you to manually force this component to pulse right now.
This method calls TryPulse on all active and enabled LeanPulse instances with the specified GameObject name.
This method calls Pulse on all active and enabled LeanPulse instances with the specified GameObject name.
This component allows you to resize the specified RectTransform when you drag on this UI element.
If you want this GameObject to act as a resize handle, and for a different object to actually be resized then specify the target object here.
Should you be able to drag horizontally?
Horizontal resize strength.
0 = none
1 = normal
-1 = inverted
2 = centered
Should the horizontal size value be clamped?
The minimum size value.
The maximum size value.
Should you be able to drag vertically?
Vertical resize strength.
0 = none
1 = normal
-1 = inverted
2 = centered
Should the vertical size value be clamped?
The minimum size value.
The maximum size value.
This allows you to perform a transition when this element begins being resized.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when this element ends being resized.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform an actions when this element begins being resized.
This allows you to perform an actions when this element ends being resized.
This component adds a safe area to your UI. This is mainly used to prevent UI elements from going through notches on mobile devices.
This component should be added to a GameObject that is a child of your Canvas root.
Should you be able to drag horizontally?
Should you be able to drag vertically?
This method will instantly update the safe area RectTransform.
This component provides an alternative to Unity's UI button, allowing you to easily add custom transitions, as well as add an OnDown event.
This allows you to perform a transition when this element becomes interactable.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when this element becomes non-interactable.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This component allows you to perform a transition when this UI element is selected.
This allows you to perform a transition when this UI element is selected.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when this UI element is deselected.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This component will place the current RectTransform above the currently selected object.
The camera rendering the target transform/position.
None = MainCamera.
This allows you to perform a transition when the highlight begins.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when the highlight ends.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform an action when the highlight starts.
This allows you to perform an action when the highlight ends.
This component allows you to force selection of a selectable, or select a previously selected object.
If the scene contains at least one selectable, and there is currently no selected object, should it be selected?
This stores a list of all selectables in the order they were selected. This allows selection to revert to a previous one if the current selectable becomes unselectable.
This component marks the current GameObject as being high priority for selection.
This setting is used by the LeanSelectionManager when decided what to select.
This allows you to set the priority of this GameObject among others when being automatically selected.
This component allows you to shake the specified Transform, with various controls for shake axes, strength, dampening, etc.
This allows you to set the speed of the shake animation.
This allows you to set the current strength of the shake. This value can automatically decay based on the Dampening and Reduction settings.
This allows you to set the final shake strength multiplier. This remains constant.
This allows you to set the dampening of the Strength value. This decay slows down as it approaches 0.
This allows you to set the reduction of the Strength value. This decay slows down at a constant rate per second.
This allows you to set the position axes you want to shake in local units.
This allows you to set the rotation axes you want to shake in degrees.
This component allows you to change the size of the Target RectTransform based on the size of this one.
This is very useful for text that needs to be inside a parent container, but you don't know how big that container should be.
The RectTransform whose size we want to modify.
Factor in scale when reading the size of the target?
Match the scale horizontally?
Match the scale vertically?
This component will automatically snap RectTransform.anchoredPosition to the specified interval.
Snap horizontally?
The snap points will be offset by this many pixels.
The spacing between each snap point in pixels.
The spacing between each snap point in 0..1 percent of the current RectTransform size.
The spacing between each snap point in 0..1 percent of the parent.
The snap speed.
-1 = Instant.
1 = Slow.
10 = Fast.
Snap vertically?
The snap points will be offset by this many pixels.
The spacing between each snap point in pixels.
The spacing between each snap point in 0..1 percent of the current RectTransform size.
The spacing between each snap point in 0..1 percent of the parent.
The snap speed.
-1 = Instant.
1 = Slow.
10 = Fast.
To prevent UI element dragging from conflicting with snapping, you can specify the drag component here.
This tells you the snap position as integers.
This event will be invoked when the snap position changes.
This component allows you to fire an events when the LeanSnap component's Position is at specific values.
The LeanSnap.Position you want to listen for.
The action that will be invoked.
This component allows you to detect when a finger swipes over the current RectTransform.
The swiping finger must move at least this many pixels.
The swiping finger must move MinimumDistance within this amount of seconds.
If you need the swipe to be in a specific direction, then enable this.
0 = up
90 = right
180 = down
270 = left
360 = full circle
180 = half circle
90 = quarter circle
This allows you to perform a transition when you swipe this UI element.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the LeanPlaySound (Play Sound Transition) component can be used to play a click sound.
This allows you to perform an action when you swipe this UI element.
This component allows you to make an UI element that can switch between any number of states.
This stores all active and enabled LeanSwitch instances.
This is the currently active state of the switch.
For example, if this is 0 then the switch is currently in the first transition state.
This stores a list of all switch transition states. This controls how many states can be switched between.
For example, if you want to be able to switch between 4 states, then make sure the size of this list = 4.
This allows you to perform a transition when this switch changes to a different state.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the LeanPlaySound (Play Sound Transition) component can be used to play a switch sound.
This allows you to perform an action when this switch changes to a different state.
This allows you to switch to a different state, where 0 is the first state. The amount of states is defined by the size of the Transitions list.
This allows you to switch all active and enabled states with the specified name to the specified state.
This component allows you to make a UI element that can switch between two states.
For example, you could create a panel that shows and hides using this component.
This stores all active and enabled LeanToggle instances.
This lets you change the current toggle state of this UI element.
If you enable this, then any sibling GameObjects (i.e. same parent GameObject) will automatically be turned off.
This allows you to make radio boxes, or force only one panel to show at a time, etc.
This allows you to perform a transition when this toggle turns on.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when this toggle turns off.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform an action when this toggle turns on.
This allows you to perform an action when this toggle turns off.
This allows you to set the toggle on or off.
This allows you to toggle the state of this toggle (i.e. if it's turned on, then this will turn it off).
If this toggle is turned off, then this will turn it on.
This will search for any sibling toggles (i.e. they have the same parent GameObject), and turn them off.
This will go through every toggle in the scene except this one, and turn them off.
This will return true if all the active and enabled toggle instances with the specified GameObject name are turned on.
This will return true if all the active and enabled toggle instances with the specified GameObject name are turned off.
This allows you to set the On state of all the active and enabled toggle instances with the specified GameObject name.
This allows you to toggle the state (i.e. if it's turned on, then this will turn it off) of all active and enabled toggle instances with the specified GameObject name.
This allows you to turn on every active and enabled toggle instance with the specified GameObject name.
This allows you to turn off each active and enabled LeanToggle instance with the specified GameObject name.
This component allows you to display a tooltip as long as the mouse is hovering over the current UI element, or a finger is on top.
Tooltips will display for any raycastable UI element that has the LeanTooltipData component.
This allows you to control when the tooltip will appear.
HoverOrPress = When the mouse is hovering, or when the mouse/finger is pressing.
Hover = Only when the mouse is hovering.
Press = Only when the mouse/finger is pressing.
This allows you to delay how quickly the tooltip will appear or switch.
Move the attached Transform when the tooltip is open?
This allows you to control how the tooltip will behave when it goes outside the screen bounds.
FlipPivot = If the tooltip goes outside one of the screen boundaries, flip its pivot point on that axis so it goes the other way.
ShiftPosition = If the tooltip goes outside of the screen boundaries, shift its position until it's back inside.
This allows you to perform a transition when this tooltip appears.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform a transition when this tooltip hides.
You can create a new transition GameObject by right clicking the transition name, and selecting Create.
For example, the Graphic.color Transition (LeanGraphicColor) component can be used to change the color.
This allows you to perform an action when this tooltip appears.
This allows you to perform an action when this tooltip hides.
This component allows you to associate text with this GameObject, allowing it to be displayed from a tooltip.
If you want this tooltip to hide when a selectable (e.g. Button) is disabled or non-interactable, then specify it here.
This allows you to set the tooltip text string that is associated with this object.
This component works just like LeanToggle, but it registers itself with the LeanWindowCloser.
This allows the window to be automatically closed if you press the LeanWindowCloser.CloseKey.
This component allows you to automatically close the top-most LeanWindow when you press the specified key.
This stores all active and enabled LeanWindowCloser instances.
This allows you to set the key that must be pressed to close the window on top.
If every window is closed and you press the close key, this window will be opened. This can be used to open an options menu.
This stores a list of all opened windows, in order of opening, so they can be closed in reverse order.
This allows you to close all open LeanWindows.
This allows you to close the top most LeanWindow.