Lean Touch+


DOCUMENTATION

What is Lean Touch+?

Lean Touch+ is an extension to Lean Touch, adding many new demo scenes, and many new components.

The new components are also designed to be very flexible, so you can combine them in any way you like.

NOTE  Because this asset is an extension to Lean Touch, I recommend you read the Lean Touch documentation too!


How do I get started?

Simply go through all the demo scenes in the Touch+/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 text at the bottom also tells you in detail which components or settings were added/changed to achieve the effects seen.

If you feel like any feature isn't explained well enough, or that a feature is missing, then let me know so I can improve this asset!



What Examples Are Included?

This is a list of the in-game example scenes and a description of what it shows.

Finger Held

This shows you how to detect when your finger has been touching the screen for more than 1 second without moving. This is done using the LeanFingerHeld component, which invokes events when this happens, and when you later stop touching the screen, or move your finger too much. You can modify this component's MinimumAge and MaximumMovement settings to change how it behaves.

Spawn

This shows you how to make a first person camera that can look around when you drag the screen.

Finger Tap Expired

This shows you how to perform an action using a single or double tap, without them interfering with each other. This is done using the LeanFingerTapExpired component, which executes when your tapping finger has stopped tapping for long enough that the tap counter has been reset. You can adjusting this timing with the LeanTouch.TapThreshold setting.

Rotate

This shows you how to perform an action using a single or double tap, without them interfering with each other. This is done using the LeanFingerTapExpired component, which executes when your tapping finger has stopped tapping for long enough that the tap counter has been reset. You can adjusting this timing with the LeanTouch.TapThreshold setting.

Isolate

This shows you how to perform an action using a single or double tap, without them interfering with each other. This is done using the LeanFingerTapExpired component, which executes when your tapping finger has stopped tapping for long enough that the tap counter has been reset. You can adjusting this timing with the LeanTouch.TapThreshold setting.

Multi Twist

This shows you how to detect the multi twist gesture using the LeanMultiTwist component. This component's OnTwistDegrees event is connected to the LeanRoll.DecrementAngle method, which allows you to change the rotation of the arrow.

One Finger

This shows you how the MultiTwist demo scene can be modified to work with a one finger twist gesture. This is done by changing the OneFinger setting to ScreenCenter or FingerStart.

Axis

This shows you how the MultiTwist demo scene can be modified to work with a one finger twist gesture. This is done by changing the OneFinger setting to ScreenCenter or FingerStart.

Delay

This shows you how to rotate an object with a delay. This is useful if you need very precise positioning on a touch device, because when you release your finger typically your finger can move slightly and unexpectedly add some movement. This is done using the LeanDelatedValue component, where the LeanMultiTwist.OnTwistDegrees event is connected to the LeanDelayedValue.SetX method, which after a delay invokes the LeanDelayedValue.OnValueX method, which is connected to the LeanManualRotate.RotateA method.

Multi Tap

This shows you how LeanMultiTap can be used to detect a multi finger tap gesture,

Translate Rigidbody

This shows you how LeanDragTranslateRigidbody can be used to translate a Rigidbody GameObject.

Under

This shows you how to combine Select3D and DragToThrowTarget, allowing you to throw objects around the screen with force indicators.

Translate Rigidbody2D

This shows you how LeanDragTranslateRigidbody2D can be used to translate a Rigidbody2D GameObject.

Under

This shows you how LeanDragTranslateRigidbody2D can be used to translate a Rigidbody2D GameObject.

First Down & Last Up

This shows you how to detect when the first finger begins touching the screen, and when the last finger finishes touching the screen. This is done using the LeanFirstDown and LeanLastUp component.s

Multi Held

This shows you how to detect when your finger has been touching the screen for more than 1 second without moving. This is done using the LeanFingerHeld component, which invokes events when this happens, and when you later stop touching the screen, or move your finger too much. You can modify this component's MinimumAge and MaximumMovement settings to change how it behaves.

GrabSpinThrow

This shows you how LeanTranslateRigidbodySmooth can be combined with LeanSelectableDragTorque to pick up, spin, and throw Rigidbody GameObjects.

PressureScale

This shows you how LeanSelectablePressureScale can scale the current selectable based on the pressure of the selecting finger.

ReplayFinger

This shows you how LeanRecordFinger can record the movement of the last finger, and replay it when pressing a button.

Slingshot

This shows you how the LinePowerThrow2D demo scene can be modified to work like a slingshot game. The sphere's Rigidbody2D is marked as kinematic to stop it from moving, and when released the LeanDragLine.OnReleasedDelta event maked it dynamic, disables the LeanSelect component, and finally applies velocity. The LeanDragLine.Invert setting is also used to invert the power indicator.

SwapBlocks2D

This shows you how LeanMatchBlock can implement an input system similar to match-3 style games.

TransformRevert

This shows you how the Select3DTransformRelative demo scene can be modified to revert the transform values when you deselect an object. This is done using the LeanRevertTransform component. The reversion is triggered using the LeanSelectable component\u2019s OnSelect and OnDeselect events to call the LeanRevertTransform component\u2019s StopRevert and Revert methods.

TransformToggle

This shows you how the Transform3D demo scene can be modified to limit transformation to one gesture at a time. This is done using the LeanGestureToggle component, which can enable/disable the specified twist, pinch, and drag components based on which gesture you perform first.

Orbit

This shows you how to orbit the camera around a 3D point when you drag across the screen. This is done by making a new GameObject called "Camera Pivot", and adding the LeanMultiSet and LeanPitchYaw components to it. You then connect the LeanMultiSet component's OnDelta event to the LeanPitchYaw.Rotate function. You can then drag and drop your camera to make it a child of this pivot GameObject. The orbit distance can be controlled using the camera's Transform.Position.z setting.

Zoom

This shows you how the Orbit demo scene can be modified to include camera FOV zooming. This is done by adding the LeanPinchCamera component to your main camera.

Wheel

This shows you how the Orbit / Zoom demo scene can be modified to allow for mouse wheel adjustment of the zooming. This is done using the LeanMouseWheel component, where its OnDelta event is connected to the LeanPinchCamera component's MultiplyZoom method. The LeanMouseWheel component's Coordinate setting should be set to OneBased, so it sends values suitable for multiplication.

Relative

This shows you how the Orbit / Zoom demo scene can be modified to zoom relative to where on the screen you pinch. This is done by enabling the LeanPinchCamera component's Relative setting. The ScreenDepth setting must also be set so the relative calculations are based on the correct depth (not important with an orthographic camera).

Auto Rotate

This shows you how the Orbit demo scene can be modified to include auto rotation when you stop rotating the orbit for more than 1 second. This is done by adding the LeanPitchYawAutoRotate component alongside the LeanPitchYaw component.

Dolly

This shows you how the CameraOrbit demo scene can be modified to allow the camera to move

Collision

This shows you how the CameraOrbitDolly demo scene can be modified to stop objects blocking

Center

This shows you how the pivot point of an orbiting camera can snap to your object selection.

Move

This shows you how the Orbit demo scene be modified to allow manual movement of the orbit center point. This is done by adding the LeanDragcamera component to your camera pivot GameObject. You can then change the LeanDragCamera.ScreenDepth setting to CameraDistanceAuto, and adjust the Use.RequiredFingerCount settings to prevent your controls from conflicting.

TopDown

This shows you how the Orbit / Move demo scene can be modified to work in a top down scenario. This is done by adding the LeanDragCamera component to the camera pivot point with a ScreenDepth setting of PlaneIntercept with a LeanPlane that lies flat on the ground plane.

Swipe

This shows you how to modify the Orbit demo scene to rotate the camera when you swipe the screen. This is done by replacing the LeanMultiDrag component with the LeanFingerSwipe component, and connecting its OnDelta event to the LeanPitchYaw.Rotate method.

Snap

This shows you how the LeanPitchYaw component's SetYaw and SetPitch functions can be called from UI buttons to reset the pitch, yaw, or both, to a specific value. This allows you to focus the camera on a specific point of interest.

First Person

This shows you how to make a first person camera that can look around when you drag the screen.

Move

This shows you how LeanPitchYaw/Smooth can be split in two, allowing you to translate the camera locally without using the camera pitch like in an FPS game.

Tap Look

This shows you how the FirstPersonLook demo scene can be modified to allow you to tap look as well.

Freeflight

This shows you how to create a free flight camera system, where you have 6 degrees of freedom. You can see the children of the Main Camera GameObject to see how this is set up. One Finger Drag = Pitch/Yaw. Twist = Roll. Two Finger Drag = Left/Right & Down/Up. Pinch = Forward/Back.

Rigidbody

This shows you how the FreeflightCamera demo scene can be modified to allow movement of a Rigidbody camera. This is done by replacing the LeanManualTranslate components with the LeanManualTranslate Rigidbody component.

Object

This shows you how to make a GameObject that can be controlled across 6 degrees of freedom.

Sidescroll 2D

This shows you how the LeanDragCamera component can be added to your camera to create a 2D sidescrolling camera.

Zoom

This shows you how the Sidescroll 2D demo scene can be modified to include camera zooming. This is done by adding the LeanPinchCamera component to the camera GameObject.

Constrain

This shows you how the LeanConstrainToOrthographic component can be used to constrain an orthographic camera to a LeanPlane with a fixed size, even when the camera's orthographic size/zoom changes.

Rotate

This shows you how the Sidescroll 2D / Zoom demo scene can be modified to include camera rotation. This is done by adding the LeanTwistCamera component to the camera GameObject.

Map

This shows you how the Sidescroll2DZoomRotate demo scene can be modified to work like most 2D map applications. This is done by enabling the LeanPinchCamera.Relative and LeanTwistCamera.Relative settings. The current camera control mode can be toggled between using the LeanGestureToggle component, which will change based on the first gesture you perform.

Sidescroll 3D

This shows you how the LeanDragCamera component can be added to your camera to create a 3D sidescrolling camera.

Zoom

This shows you how the Sidescroll 3D demo scene can be modified to include camera zooming. This is done by adding the LeanPinchCamera component to the camera GameObject.

Rotate

This shows you how the Sidescroll 3D / Zoom demo scene can be modified to include camera rotation. This is done by adding the LeanTwistCamera component to the camera GameObject.

Top Down

This shows you how the LeanFingerSwipe and LeanManualTranslate components

SwipeMove

This shows you how the LeanFingerSwipe and LeanManualTranslate components

Clamp

This shows you how the TopDownSwipeMove demo scene can be combined with the ConstrainToCollider demo scene, adding a BoxCollider to the camera movement.

Conflicting Controls

This shows you how to make it so finger drags can both rotate the camera, and move selected objects, without either action conflicting. This is done using the LeanSelectedCount component, which invokes events based on how many objects you have selected. These events can be used to enable/disable the LeanMultiUpdate component, which is used to control the camera orbit.

One Finger Zoom

This shows you how to control camera zoom using a one finger drag up or down gesture. This is done using the LeanPinchCamera for the camera zoom, and setting Use = ManuallyAddedFingers to disable the default pinch gesture to zoom. The LeanMultiDirection component is then used to detect the vertical (up & down) finger movement. Its OnDelta event sends the delta to the LeanPinchCamera.IncrementZoom method. You can control the drag direction using the Angle setting.

Finger Down Canvas

This shows you how the LeanFingerDownCanvas component can be added to your UI elements, allowing you to detect when a finger presses down on it. In this scene the LeanFingerDownCanvas.OnWorld event is used to output the world position of the finger to the LeanFormatString component's SetString function.

Move

This shows you how to move an object when you press on a UI element. This is done using the LeanFingerDownCanvas and LeanManualTranslate components. The LeanFingerDownCanvas.OnFingers event calls the LeanManualTranslate.TranslateB function, with different distance values to change direction. The movement axis can be changed from the LeanManualTranslate.DirectionB setting.

Swipe Move

This shows you how LeanFingerSwipe.OnSwipeDelta can be linked to LeanManualTranslate.Translate, to translate a GameObject along custom axes.

Multi Update Canvas

This shows you how the LeanMultiSetCanvas component can be added to your UI elements, allowing you to detect when fingers are touching it. In this scene the LeanMultiSetCanvas.OnWorldTo event is used to output the world position of the finger to the LeanFormatString component's SetString function.

Rotate

This shows you how LeanFingerDownCanvas can manually send fingers to LeanMultiSet.

DPad

This shows you how LeanCanvasSet can trigger LeanManualRotate/Smooth.RotateA/B,

Move

This shows you how LeanFingerDownCanvas can manually send fingers to LeanMultiSet.

Drag To Spawn

This shows you how to spawn objects when a finger touches down on an UI element, and how to position the object under the finger until it releases. This is done by adding the LeanFingerDownCanvas component to your UI element, and the LeanSpawnWithFinger component. The LeanFingerDownCanvas.OnFinger event is connected to the LeanSpawnWithFinger.Spawn function, which will spawn the object when you touch the UI element. The LeanSpawnWithFinger.DragAfterSpawn setting is then enabled to allow dragging of the spawned object until the spawning fingers stops touching the screen.

Selectable

This shows you how to modify the Drag To Spawn demo scene to select the spawned object while the spawning finger is still touching the screen. This is done by enabling the LeanSpawnWithFinger component's SelectOnSpawn and DeselectOnUp settings. Keep in mind the spawned prefab must have the LeanSelectable component. In this demo scene the LeanSelectableRendererColor component is also used to show the color of the selected object.

Drop

This shows you how the Drag To Spawn / Selectable demo scene can be modified to work with Rigidbody GameObjects. This is done by enabling the prefab's Rigidbody.isKinematic setting, and connecting the prefab's LeanSelectableByFinger.OnDeselected event to the Rigidbody.isKinematic = false function.

Destroy If Blocked

This shows you how the Drag To Spawn demo scene can be modified to destroy the spawned prefab if it's dropped on top of a UI element. This is done by enabling the LeanSpawnWithFinger component's DestroyIfBlocked setting.

Required Tag

This shows you how the Drag To Spawn / Destroy If Blocked demo scene can be modified to destroy the spawned prefab if it's not dropped on the correct GameObject. This is done using tags, and setting the LeanSpawnWithFinger component's ScreenQuery.RequiredTag setting.

Swipe Direction Spawn

This shows you how the Drag To Spawn / Selectable / Drop demo scene can be modified to spawn a different prefab based on your swipe direction. This is done using multiple LeanManualFlick components with different angle requirements. The LeanFingerDownCanvas.OnFinger event is instead used to send the finger to each of these components using the LeanManualFlick.AddFinger function. The LeanManualFlick.OnFinger even is then connected to each LeanSpawnWithFinger.Spawn function to perform the spawn based on the direction you swiped in.

Constrain Scale

This shows you how LeanMultiDrag.OnDragDelta can trigger LeanManualRotate.Rotate, allowing you to rotate a GameObject along custom axes.

Constrain To Box

This shows you how the position of an object can be constrained to a box shape using the LeanConstrainToBox component.

Constrain To Axis

This shows you how the position of an object can be constrained along a specific axis using the LeanConstrainToAxis component. You can control the axis with the Axis setting, and adjust the Minimum and/or Maximum values.

Constrain To Collider

This shows you how the position of an object can be constrained to be inside a collider using the LeanConstrainToCollider component. If you don't want your boudnary to collide with your other objects then you can enable the isTrigger setting, and/or place the boundary on a layer that doesn't collide.

Constrain To Colliders

This shows you how the position of an object can be constrained to be inside multiple colliders using the LeanConstrainToColliders component. If you don't want your boudnary to collide with your other objects then you can enable the isTrigger setting, and/or place the boundary on a layer that doesn't collide.

Constrain To Direction

This shows you how the rotation of a Transform can be constrained to be inside the specified cone. You can select the Red Cube GameObject to see the cone in the Scene tab.

Constrain Rigidbody

This shows you how your Rigidbody can be constrained within a boundary. This is done by adding colliders to your boundary and object, and using the LeanDragTranslateRigidbody component on your object. Keep in mind this scene enables the Rigidbody.Constraints.FreezePosition.Z setting to maintain the side-scrolling effect.

Constrain Rigidbody2D

This shows you how your Rigidbody2D can be constrained within a boundary. This is done by adding colliders to your boundary and object, and using the LeanDragTranslateRigidbody2D component on your object.

Dial 3D

This shows you how LeanSelectableDial can be used to turn objects around an axis like a knob or dial.

Clamp

This shows you how LeanSelectableDial can be used to turn objects around an axis like a knob or dial.

Lever

This shows you how LeanSelectableDial can be used to turn objects around an axis like a knob or dial.

Trigger

This shows you how LeanSelectableDial can be used to turn objects around an axis like a knob or dial.

Angle

This shows you how LeanSelectableDial can be used to turn objects around an axis like a knob or dial.

0 to 1

This shows you how LeanSelectableDial can be used to turn objects around an axis like a knob or dial.

UI

This shows you how LeanSelectableDial can be used

Rotate To Position

This shows you how LeanSelectableDial can be used to turn objects around an axis like a knob or dial.

Under

This shows you how LeanSelectableDial can be used to turn objects around an axis like a knob or dial.

Drag

This shows you how to modify DragTurn2D to be 1D by setting LeanManualRotate2D/Smooth.Axis B to 0,0,0.

Turn 2D

This shows you how LeanMultiDrag.OnDragDelta can trigger LeanManualRotate.Rotate, allowing you to rotate a GameObject along custom axes.

Reset

This shows you how LeanMultiDrag.OnDragDelta can trigger LeanManualRotate.Rotate, allowing you to rotate a GameObject along custom axes.

DragTurn1D

This shows you how to modify DragTurn2D to be 1D by setting LeanManualRotate2D/Smooth.Axis B to 0,0,0.

Step

This shows you how the DragTurn2D demo scene can be modified to have stepped rotation instead of continuous rotation. This is done using the LeanThresholdDelta component. By changing the LeanMultiSet.OnDelta to LeanThresholdDelta.AddXY, the LeanThresholdDelta.Current value is smoothly incremented. Once this reaches the Threshold with Step enabled, it will invoke the OnDeltaXY event, which sends the stepped values to LeanManualRotate.RotateAB.

DragDoors

This shows you how the Press3D and DragTurn1D demo scene can be combined to make doors that you can open and close by dragging across them. The LeanPitchYaw component\u2019s YawClamp setting to set rotation limits.

DragMove1D

This shows you how the DragMove2D demo scene can be modified to limit translation to 1 axis. This is done by setting the LeanManualTranslate component\u2019s DirectionB setting to 0,0,0.

DragMove2D

This shows you how dragging fingers across the screen can move an object along custom axes. This is done using the LeanMultiDrag component, and having its OnDelta event call the LeanManualTranslate component\u2019s TranslateAB method.

Threshold

This shows you how the LeanThresholdDelta component can be used between the LeanMultiSet and LeanManualTranslate components using events to only move the object when your finger/mouse moves more than 1 unit.

DragAlongPath

This shows you how to drag objects along a LeanPath using the LeanDragTranslateAlong component.

Under

This shows you how to drag objects along a LeanPath using the LeanDragTranslateAlong component.

Smooth

This shows you how to drag objects along a LeanPath using the LeanDragTranslateAlong component.

DragUnderAlongPlane

This shows you how LeanDragTranslateAlong can be used to move objects along a LeanPlane.

Snap

This shows you how the DragAlongPlane demo scene can be modified to allow snapping to a grid.

Pull

This shows you how LeanMultiDrag.OnDragDelta can trigger LeanManualRotate.Rotate, allowing you to rotate a GameObject along custom axes.

Turn 2D

This shows you how LeanMultiDrag.OnDragDelta can trigger LeanManualRotate.Rotate, allowing you to rotate a GameObject along custom axes.

Direction

This shows you how LeanMultiDrag.OnDragDelta can trigger LeanManualRotate.Rotate, allowing you to rotate a GameObject along custom axes.

DragTorque

This shows you how to modify DragTurn2D to be 1D by setting LeanManualRotate2D/Smooth.Axis B to 0,0,0.

DragRescale

This shows you how to modify DragTurn2D to be 1D by setting LeanManualRotate2D/Smooth.Axis B to 0,0,0.

DragMeshColor

This shows you how the Select3D demo scene can be modified to allow vertex color painting. This is done by adding the LeanDragColorMesh component to your selectable objects alongside a MeshFilter.

DragMeshDeform

This shows you how the Select3D demo scene can be modified to allow vertex position shifting. This is done by adding the LeanDragDeformMesh component to your selectable objects alongside a MeshFilter.

DropDestroy

This shows you how Press2DTranslate can be modified so any with LeanSelectableDrop GameObjects get destroyed by LeanDropDestroy when dropped on top.

DropDestroyCount

This shows you how Press2DTranslate can be modified so any with LeanSelectableDrop GameObjects get destroyed by LeanDropDestroy when dropped on top.

Chase 3D

This shows you how the LeanChase component can be used to make the red cube follow fingers around the screen. This is done using the LeanMultiSet component, where the OnPosition event can send a position to the LeanChase.SetPosition method.

Under

This shows you how the Chase 3D and Press3D demo scenes can be combined.

Waypoints

This shows you how to make an object follow different waypoints when you press a button. This is done by placing a Transform in the scene, and having the button's event set the LeanChase.Destination value to the specified waypoint. The GameObject with the LeanChase component will then move toward that point.

Chase Rigidbody

This shows you how to make a Rigidbody chase the fingers touching the screen. This is done using the LeanChase Rigidbody component, where the chase position is driven using the LeanMultiPosition and LeanConvertPosition components. The LeanMultiPosition.OnPosition event is connected to the LeanConvertPosition.Convert method. The LeanConvertPosition.OnPosition event is connected to the LeanChaseRigidbody.SetPosition method.

Plane

This shows you how the Chase Rigidbody demo scene can be modified to allow for dragging along a custom plane, rather than maintaining a constant camera distance. This is done by changing the LeanMultiSet.ScreenDepth setting to PlaneIntercept, and specifying our custom LeanPlane that aligns to the grid.

Chase Rigidbody2D

This shows you how to make a Rigidbody2D chase the fingers touching the screen. This is done using the LeanChaseRigidbody2D component, where the chase position is driven using the LeanMultiPosition and LeanConvertPosition components. The LeanMultiPosition.OnPosition event is connected to the LeanConvertPosition.Convert method. The LeanConvertPosition.OnPosition event is connected to the LeanChaseRigidbody2D.SetPosition method.

FollowFinger

This shows you how LeanSelectable.OnSelect can call LeanFollowFinger.BeginFollowing.

Released

This shows you how the FollowFinger demo scene can be modified to only allow movement when the selecting finger stops touching the screen. This is done by disabling the LeanFollow component, and enabling it from the LeanSelectable.OnDeselect event. Upon completion, the LeanFollow component disables itself from the OnReachedDestination event.

Rotation

This shows you how the FollowFinger demo scene can be modified so the following objects rotate to the direction of the path. This is done by adding the LeanRotateToPosition component to your selectable object. The LeanRotateToPosition .RotateTo setting can be adjusted based on your scene setup, which in this case is a sidescrolling scenario, so the Side2D setting works well.

FollowFingerLine

This shows you how the Line demo scene can be combined with the FollowFinger demo scene, causing an object to spawn and follow the path of a line you draw on the screen. This makes heavy use on the LeanDragLine component's OnReleasedFrom and OnReleasedTo events. These set up the prefab settings before spawning, then spawn when released.

Line

This shows you how the LeanDragLine component can be used to draw a straight line under each finger touching the screen. The line style can be customized using the Prefab setting, which has a LineRenderer.

Power

This shows you how the LeanDragLine can be used to draw a line under each finger.

Clamp

This shows you how the length of the line can be clamped using the LeanDragLine component's LengthMin and LengthMax settings.

SpawnThrow 3D

This shows you how to spawn and throw a Rigidbody when your finger stops touching the screen. This is done using the LeanSpawnBetween component, whose Spawn function can be triggered from the LeanDragLine component's OnReleasedFromTo event.

SpawnThrow 2D

This shows you how to spawn and throw a Rigidbody2D when your finger stops touching the screen. This is done using the LeanSpawnBetween component, whose Spawn function can be triggered from the LeanDragLine component's OnReleasedFromTo event.

Target 3D

This shows you how the Line / Clamp demo scene can be modified so the line always begins at the object center. This is done by enabling the LeanDragLine component's StartAtOrigin setting.

Throw

This shows you how the Target 3D demo scene can be modified to throw a Rigidbody around the screen with a power indicator following each finger. This is done by adding the LeanManualTranslateRigidbody component, and linking the LeanDragLine component's OnReleaseDelta event to the LeanManualTranslateRigidbody.TranslateWorld method.

Under

This shows you how the Select 3D and Target 3D / Throw demo scenes can be combined, allowing you to throw objects under the finger with a strength indicator.

Target 2D

This shows you how the Line / Clamp demo scene can be modified so the line always begins at the object center. This is done by enabling the LeanDragLine component's StartAtOrigin setting.

Throw

This shows you how the Target 3D demo scene can be modified to throw a Rigidbody2D around the screen with a power indicator following each finger. This is done by adding the LeanManualTranslateRigidbody component, and linking the LeanDragLine component's OnReleaseDelta event to the LeanManualTranslateRigidbody.TranslateWorld method.

Rotate

This shows you how the Target 2D / Throw demo scene can be modified to rotate the Rigidbody2D to match the throw indicator. This is done using the LeanRotateToPosition component with a Position setting of ManuallySetPosition, and a RotateTo setting of Side 2D. The rotate to position is manually set using the LeanMultiPull component's OnWorldTo event.

Under

This shows you how the Select 2D and Target 2D / Throw demo scenes can be combined, allowing you to throw objects under the finger with a strength indicator.

Pong Launch

This shows you how the LeanDragLine component's ScreenDepth setting can be set to PathClosest, allowing you to limit the launch angle to the specified path.

Reselect Count

This shows you how LeanSelect.Reselect can be set to Select Again, and how you can use LeanSelect.OnSelect to count how many times it's selected again.

Selected Time

This shows you how the Press To Select demo scene can be modified to show you how long you\u2019ve selected an object for. This is done by adding the LeanSelectableTime component whose OnSeconds event can be used to perform some action. In this scene the LeanFormatString component is used to display the time using UI text.

Action

This shows you how Select2D can be combined with LeanSelectableSelected/Time to trigger LeanSelectable.Deselect after 1 second.

DragSelect

This shows you how LeanDragSelect can select multiple objects using a drag gesture.

TransformRelative

This shows you how the DragSelect and TranslateRelative demo scenes can be combined, allowing screen drags to both allow selection of objects, as well as translation of objects.

WithinRange

This shows you how the LeanDragSelect.MaximumSeparation can be used to only allow you to select objects within range of the previously selected object.

SelectionBox

This shows you how to select objects in the style of strategy games by dragging a selection box across the screen. This is done using the LeanSelectionBox component, where its Root setting is set to your canvas root, and the Prefab setting is set to a selection box prefab that will be spawned when you drag across the screen.

Dotted

This shows you how to select objects in the style of strategy games by dragging a selection box across the screen. This is done using the LeanSelectionBox component, where its Root setting is set to your canvas root, and the Prefab setting is set to a selection box prefab that will be spawned when you drag across the screen.

Pickable

This shows you how the LeanPickable component can be used to detect when you touch a GameObject without using the selection system. This object can then be picked by making a new GameObject with the LeanPick component, whose SelectScreenPosition function can be called from a component that gives you a finger, like the LeanFingerTap component's OnFinger event used in this scene. This pick system doesn't require the LeanSelect/ByFinger or LeanSelectable/ByFinger components to work, so it can be used for more complex scenarios where normal selection alone isn't enough.

Down

This shows you how the Pickable demo scene can be modified to work using the LeanFingerDown component, giving you instant picking that feels more responsive.

Press

This shows you how the Pickable / Down demo scene can be modified to work like press selection. This is done using the LeanMultiUp component with its Use setting set to ManuallyAddedFingers. The LeanPickable.OnFinger event is used to change the object material to indicate selection, and also add the finger via the LeanMultiUp.AddFinger function. The LeanMultiUp.OnFinger event is then used to detect when all fingers go up, and revert the material to its original state.

Count

This shows you how the Pickable / Down demo scene can be modified to work like press selection. This is done using the LeanMultiUp component with its Use setting set to ManuallyAddedFingers. The LeanPickable.OnFinger event is used to change the object material to indicate selection, and also add the finger via the LeanMultiUp.AddFinger function. The LeanMultiUp.OnFinger event is then used to detect when all fingers go up, and revert the material to its original state.

ShapeDetector

This shows you how to detect drawing of basic letter shapes. This is done using the LeanShapeDetector component, which detects the specified LeanShape component. You can select a shape and click the Draw button to modify it. You can modify the LeanShapeDetector's DistanceThreshold and ErrorThreshold settings to make the shape easier or more difficult to draw.

Loop

This shows you how LeanShape.ConnectEnds can be enabled. This allows you to make a looped shape.

Direction

This shows you how the ShapeDetector / Loop demo scene can be modified to allow for detection of the drawing direction. This is done using two LeanShapeDetector components, where you change the Direction setting to Forward or Backward. You can then link the OnDetected events to perform custom actions in either scenario.

Partial

This shows you how the LeanShapeDetector.MinimumPoints setting allows you to detect partial shape matches.

Finger Swipe

This shows you how LeanFingerSwipe can trigger LeanSwap to swap between a selection of prefabs.

Swap

This shows you how LeanFingerSwipe can trigger LeanSwap to swap between a selection of prefabs.

Move

This shows you how LeanFingerSwipe.OnSwipeDelta can be linked to LeanManualTranslate.Translate, to translate a GameObject along custom axes.

Turn

This shows you how LeanFingerSwipe.OnSwipeDelta can be linked to LeanManualRotate.Rotate, to rotate a GameObject along custom axes.

Translate

This shows you how to combine Select3D and DragToThrowTarget, allowing you to throw objects around the screen with force indicators.

Under

This shows you how to combine Select3D and DragToThrowTarget, allowing you to throw objects around the screen with force indicators.

Translate Rigidbody

This shows you how to combine Select3D and DragToThrowTarget, allowing you to throw objects around the screen with force indicators.

Under

This shows you how to combine Select3D and DragToThrowTarget, allowing you to throw objects around the screen with force indicators.

TranslateRigidbody2D

This shows you how to combine Select3D and DragToThrowTarget, allowing you to throw objects around the screen with force indicators.

Under

This shows you how to combine Select3D and DragToThrowTarget, allowing you to throw objects around the screen with force indicators.

Finger Flick

This shows you how to instantly detect swipes, even while your finger is still moving across the screen. This is done using the LeanFingerFlick component. You can control the maximum flick duration and minimum flick distance from the LeanTouch component's TapThreshold and SwipeThreshold settings respectively.

Rotation

This shows you how to rotate a UI element based on a screen flick gesture. This is done using the LeanFingerFlick and LeanRoll components, and connecting the LeanFingerFlick.OnDelta event to the LeanRoll.RotateToDelta function.

Multiple

This shows you how the LeanFingerFlick component's Check setting can be set to Multiple. This allows you to detect multiple flicks from the same finger, as long as the finger movement pauses between each flick. The time and movement required between each flick can be controlled using the LeanTouch component's TapThreshold and SwipeThreshold settings.

Multi Swipe

This shows you how to detect multi finger swipe gestures using the LeanMultiSwipe component. This can detect when multiple fingers swipe in parallel, when multiple fingers swipe inward, and when multiple fingers swipe outward.







Assets

Here's a list of all my other assets, please check them out!

You can also view this list on my Asset Store page.

Lean Touch

Lean Touch

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+

Lean Touch+

Lean Touch+ is an extension to the popular Lean Touch asset, adding many more example scenes.


Lean Localization

Lean Localization

Lean Localization is a localization library that's designed to be as simple to use as possible for both designers, and programmers.


Lean Pool

Lean Pool

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.


Lean Transition

Lean Transition

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

Lean GUI

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

Lean GUI Shapes

Lean GUI Shapes allows you to quickly add lines, rounded boxes, polygons, and much more to your GUI!


Lean Texture

Lean Texture

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+

Lean Texture+

Lean Texture+ is an extension to Lean Texture, adding many new types of texture modification tools!


CW Spaceships - Build & Destroy

Spaceships - Build & Destroy

Build your dream spaceship, and then have fun destroying it!


Modular Backgrounds

Modular Backgrounds

Unlock a universe of visual possibilities with Modular Backgrounds. Simply drag and drop these graphics into the background of your scenes.


Paint in 3D

Paint in 3D

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!


Paint in 2D

Paint in 2D

Paint all your sprites with Paint in 2D. With incredible performance on mobile, WebGL, and much more!


Paint in Editor

Paint in Editor

Paint in Editor unlocks the ability to paint objects in your scene - great for making small tweaks, or even creating entirely new texture sets!


FLOW

FLOW

FLOW allows you to add large scale interactive fluids to your scene - all highly optimized using GPU acceleration.


Destructible 2D

Destructible 2D

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!


Space Graphics Toolkit

Space Graphics Toolkit

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.


Space Graphics Planets

Space Graphics Planets

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).


Volumetric Audio

Volumetric Audio

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.






Versions

3.1.0

Updated CW/Common code to latest version.



3.0.2

Moved main build to Unity 2021.3.0f1.
Updated shaders to latest version.



3.0.1

Moved main build to Unity 2020.3.0f1.
All canvas components now have IgnoreStartedOverGui disabled by default.
Removed LeanDragTranslateAlong.TrackScreenPosition setting (it's now always on).
Added LeanDragTranslateAlongRigidbody component.
Added LeanMultiUpdate.Constrain setting.
Added LeanMultiUpdateCanvas.Constrain setting.



3.0.0

NOTE  This is a massive update. To update you must first back up your project, delete the root Lean folder, then install the new version.

Changed folder structure to be inside Plugins/CW/LeanTouch+.
Updated inspector code to support third party assets that implement nested inspectors.
Fixed LeanConstrainLocalPosition using world space.
Added LeanManualRotate.RotateAxesToCamera setting.
Added LeanManualTranslate.RotateDirectionsToCamera setting.
Added LeanManualTranslateRigidbody.RotateDirectionsToCamera setting.
Added LeanManualTranslateRigidbody2D.RotateDirectionsToCamera setting.
Added LeanManualVelocity.RotateDirectionsToCamera setting.
Added LeanManualVelocity2D.RotateDirectionsToCamera setting.



2.3.5

Fixed Drag To Spawn / Destroy If Blocked / Required Tag demo scene.
Fixed transform gizmos not appearing in Unity 2021.2.



2.3.4

Fixed LeanSelectableDial for UI elements.
Updated base code.



2.3.3

Renamed LeanSpawnWithFinger.ScreenQuery setting to BlockedScreenQuery.
Added LeanSpawnWithFinger.DestroyIfMissing setting.
Added LeanSpawnWithFinger.MissingScreenQuery setting.



2.3.2

Added LeanSelectionBox.RequiredLayers setting.
Added LeanSelectionBox.RequiredTags setting.
Added LeanSpawnWithFinger.DestroyIfBlocked / ScreenQuery setting.



2.3.1

Added LeanSelectableDrop.Ignore setting for easier use.
Rewrote LeanSelectableDrop to use new ScreenQuery system.
Fixed LeanSelectableByFinger.OnSelectedFingerUp event not showing in inspector.
Added LeanSpawnWithFinger.DestroyIfBlocked setting.
Added LeanSpawnWithFinger.DeselectOnUp setting.
Added Canvas / Drag To Spawn / Destroy if Blocked demo scene.



2.3.0

NOTE  This is a huge update. Back up your project files before installing.

Moved main build to Unity 2019.4.12f1.
Fixed LeanDragTranslateAlong positional drift.
Fixed LeanFingerTapQuick adding RectTransform.
Added Selection / Select Self / Down demo scene.
Improved LeanMultiUp component implementation.
Improved LeanDropCount component implementation.
Renamed LeanSelectSelf to LeanPickable.



2.2.4

Fixed LeanPinchCamera inspector error.
Added LeanManualTorque component.
Added Drag/DragTorque demo scene.
Added LeanManualRescale component.
Added Drag/DragRescale demo scene.



2.2.3

Added LeanDelayedValue component.
Added LeanMultiDown component.
Added LeanMultiUp component.
Replaced LeanPitchYaw.RotateToFinger with RotateToScreenPosition.
Added LeanFirstDown.OnScreen event.
Added Camera/Conflicting Controls demo scene.
Replaced LeanAnySelected component with LeanSelectedCount.
Added LeanSelected component.
Added LeanDeselected component.
Fixed LeanChaseRigidbody component.
Added LeanMultiHeld component.
Added Multi Held demo scene.



2.2.2

Added LeanSelectableDial.IncrementAngle method.
Added LeanPinchCamera.IncrementZoom method.
Added Camera / One Finger Zoom demo scene.
Fixed LeanConstrainToDirection component.



2.2.1

Fixed LeanSelectSelf with Search = GetComponentInParent.
Fixed ScreenDepth = PlaneIntercept when using an offset.
Fixed LeanMultiDirection.Angle setting.
Fixed LeanSelectableDial.Tilt implementation.
Added LeanChaseRigidbody2D.Axis setting.



2.2.0

Added LeanFirstDownCanvas component.
Added LeanLastUpCanvas component.
Added LeanMultiDirection component.
Added Drag/Direction demo scene.
Added LeanSelectableDial.OnAngleChanged event.
Fixed LeanPinchCamera inspector.



2.1.9

Added multi finger support to LeanDragSelect component.
Added LeanManualTranslate.DefaultPosition value.
Added LeanManualTranslate.ResetPosition method.
Added LeanManualTranslate.SnapToTarget method.
Added LeanManualRotate.SnapToTarget method.
Added Linear setting to LeanChase components.



2.1.8

Added Canvas / Swipe Direction Spawn demo scene.
Added LeanPitchYaw.RotateToPosition method.
Added LeanPitchYaw.RotateToDirection method.
Added LeanSelectSelf.Root setting.
Added LeanManualFlick component.



2.1.7

Added LeanSelectSelf component.
Added Selection / Select Self demo scene.



2.1.6

Updated Lean Touch.



2.1.5

Separated LeanConstrainToBox from BoxColliders.
Added LeanConstrainToAxis component.
Added Constrain / Constrain To Box demo scene.
Added Constrain / Constrain To Axis demo scene.
Rewrote LeanShapeDetector to use a different implementation.
Implemented LeanShapeDetector.Use setting.



2.1.4

Added Line / Target 2D / Throw / Rotate demo scene.
Added Swipe / Finger Flick / Multiple demo scene.
Added LeanRotateToPosition.Target setting.
Added LeanRotateToPosition.Invert setting.
Added LeanFingerFlick.Check setting.
Added thresholds to LeanConstrainTo__ components for better performance.



2.1.3

Updated LeanTouch.
Renamed LeanFingerHeld.OnFingerSet to .OnFingerUpdate.
Renamed LeanFingerHeld.OnWorldSet to .OnWorldUpdate.
Renamed LeanSelectableSelected.OnSelectableSet to .OnSelectableUpdate.



2.1.2

Moved main build to Unity 2018.4.13f1.
Added Constrain / Constrain Rigidbody demo scene.
Added Constrain / Constrain Rigidbody2D demo scene.
Added LeanFirstDown component.
Added LeanLastUp component.
Added First Down & Last Up demo scene.
Fixed LeanDragTranslateRigidbody2D with perspective cameras.
Renamed LeanMultiSet to LeanMultiUpdate.
Renamed LeanMultiSetCanvas to LeanMultiSetUpdate.
Renamed LeanSelectable.OnSelectSet to OnSelectUpdate.



2.1.1

Restructured all demo scenes to be easier to use.
Added LeanThresholdPosition component.
Added LeanThresholdDelta component.
Added DragMove2DThreshold demo scene.
Added LeanDragTranslateAlong.Target setting.
Added Line / SpawnThrow Rigidbody2D demo scene.
Added LeanSpawn.DefaultPosition setting.
Added LeanSpawn.DefaultRotation setting.
Added LeanMultiSetCanvas.OnWorld event.
Fixed LeanFingerHeld.OnPositionUp not being called.
Renamed LeanFingerHeld.OnPositionDown to OnWorldDown.
Renamed LeanFingerHeld.OnPositionSet to OnWorldSet.
Renamed LeanFingerHeld.OnPositionUp to OnWorldUp.



2.1.0

Moved main build to Unity 2018.4.0f1.
Updated documentation.
Added asmdef.
Added LeanMultiPinch.Coordinate = ZeroBasedRatio setting.
Added LeanMultiPinch.Coordinate = ZeroBasedDistance setting.
Added LeanRotateToPosition.Threshold setting.
Added DialUI demo scene.



2.0.9

Renamed LeanRotateToTransform to LeanRotateToPosition.
Fixed ScreenDepth = HeightIntercept axis label.
Added LeanRotateToPosition.Position setting.
Added LookAt demo scene.
Added LookAtSelectable demo scene.



2.0.8

Added ConstrainScale demo scene.
Added FollowFingerReleased demo scene.
Added DragAlongPathSmooth demo scene.
Fixed inspector expand buttons in UI Elements.
Fixed LeanDragTranslate being slow in some scenarios.
Fixed LeanTwistRotate being slow in some scenarios.
Fixed LeanPinchScale being slow in some scenarios.
Updated common library code.



2.0.7

Added FollowFingerReleased demo scene.
Added DragAlongPathSmooth demo scene.
Fixed inspector expand buttons in UI Elements.
Fixed LeanDragTranslate being slow in some scenarios.
Fixed LeanTwistRotate being slow in some scenarios.
Fixed LeanPinchScale being slow in some scenarios.



2.0.6

Fixed bug in LeanHelper.cs that prevents making builds.



2.0.5

Updated Common library code.



2.0.4

Updated Lean Touch code.



2.0.3

Added MultiTwist demo scene.
Added MultiTwistOneFinger demo scene.
Added MultiTwist.OneFinger setting.
Fixed MultiSwipe demo scene.
Fixed MultiTap demo scene.



2.0.2

Added CanvasSwipeMove demo scene.
Fixed LeanSelectable.IsolateSelectingFingers when using RequiredFingerCount.
Fixed Added LeanSelectableBehaviour error when missing LeanSelectable.
Added LeanSelectable.Register for manual registration.
Added LeanSelectable.Unregister for manual unregistration.
Added LeanTouch.OnFingerInactive event.



2.0.1

Added SelectionBoxDotted demo scene.
Added PullTurn2D demo scene.
Added LeanMultiPull component.
Improved Dial demo scene.
Improved DialTrigger demo scene.
Improved SelectionBox demo scene.



2.0.0

NOTE  This is a MAJOR update to LeanTouch. I recommend you only use this in new projects.

Redesigned all demo scenes.
Added smoothing/dampening to all base components.
Removed all ___Smooth versions of components.
Renamed IDroppable to IDropHandler.
Renamed LeanCameraDolly to LeanMaintainDistance.
Removed LeanConstrainToBox (use LeanConstrainToCollider instead).
Renamed LeanFollowSmooth to LeanFollow.
Renamed LeanCanvasFingers to LeanFingerDownCanvas.
Renamed LeanTranslateRigidbody to LeanDragTranslateRigidbody.
Renamed LeanTranslateRigidbody2D to LeanDragTranslateRigidbody2D.
Removed LeanPitchYawSwipe component.
Removed LeanMultiSetCanvas (use LeanFingerDownCanvas + LeanMultiSet instead).
Merged LeanCanvasArrowSmooth into LeanRoll.
Merged LeanTranslateSmooth into LeanDragTranslate.
Merged LeanCameraZoomSmooth into LeanPinchZoom.
Merged LeanCameraMoveSmooth into LeanDragMove.
Merged LeanFingerLineFade into LeanFingerLine.
Merged LeanFingerTrailFade into LeanFingerTrail.







Components

IDropHandler

Any component implementing this interface will make it compatible with LeanSelectableDrop, allowing you to perform a specific action when the current object is dropped on something.



LeanDragColorMesh

This script allows you to paint the vertices of the current MeshFilter's mesh.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



Color
PaintColor

The color you want to paint the hit triangles.



Camera
Camera

The camera this component will calculate using.

None/null = MainCamera.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanDragDeformMesh

This script allows you to drag mesh vertices using finger drags.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



float
ScaledRadius

Radius around the finger the vertices will be moved in scaled screen space.



bool
ApplyToMeshCollider

Should mesh deformation be applied to an attached MeshCollider?



Camera
Camera

The camera this component will calculate using.

None/null = MainCamera.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanDragLine

This component modifies LeanDragTrail to draw straight lines.

NOTE  This requires you to enable LeanTouch.RecordFingers.

float
WidthScale

The StartWidth and EndWidth values will be increased by this value multiplied by the line length.

0 = No change.



float
LengthMin

The minimum length of the straight line in world space.

-1 = Unrestricted.



float
LengthMax

The maximum length of the straight line in world space.

-1 = Unrestricted.



bool
StartAtOrigin

Enable this if the line should begin from this Transform's position.



bool
Invert

Drag the line backwards?



Vector3Event
OnReleasedFrom

This event gets called when a trail drawing finger goes up.

Vector3 = Start world point.



Vector3Event
OnReleasedTo

This event gets called when a trail drawing finger goes up. The parameter contains the end point in world space.

Vector3 = End world point.



Vector3Event
OnReleasedDelta

This event gets called when a trail drawing finger goes up. The parameter contains the end point in world space.

Vector3 = Vector between start and end world points.



Vector3Vector3Event
OnReleasedFromTo

This event gets called when a trail drawing finger goes up.

Vector3 = Start point in world space.

Vector3 = End point in world space.




LeanDragSelect

This component allows you to select multiple objects by dragging across the screen through them.


LeanSelectByFinger
Select

The select component that will be used.



bool
RequireNoSelectables

If you begin dragging while objects are already selected, skip?



bool
RequireInitialSelection

If you begin dragging on a point that isn't above a selectable object, skip?



bool
DeselectAllAtStart

Automatically deselect all objects when the drag starts?



float
MaximumSeparation

Must the next selected object be within a specified world space distance?\n\n0 = Any distance.




LeanDragTranslateAlong

This component allows you to translate the current GameObject along the specified surface.


Transform
Target

If you want this component to work on a different Transform, then specify it here. This can be used to improve organization if your GameObject already has many components.

None/null = Current Transform.



LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



float
Damping

If you want this component to change smoothly over time, then this allows you to control how quick the changes reach their target value.

-1 = Instantly change.

1 = Slowly change.

10 = Quickly change.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanDragTranslateAlongRigidbody LeanDragTranslateAlong

This component works like LeanDragTranslateAlong, but is specifically designed to work with a Rigidbody.



LeanDragTranslateRigidbody

This component allows you to drag this rigidbody.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



Camera
Camera

The camera this component will calculate using.

None/null = MainCamera.



float
Damping

If you want this component to change smoothly over time, then this allows you to control how quick the changes reach their target value.

-1 = Instantly change.

1 = Slowly change.

10 = Quickly change.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanDragTranslateRigidbody2D

This component allows you to translate the current Rigidbody2D GameObject.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



Camera
Camera

The camera this component will calculate using.

None/null = MainCamera.



float
Damping

If you want this component to change smoothly over time, then this allows you to control how quick the changes reach their target value.

-1 = Instantly change.

1 = Slowly change.

10 = Quickly change.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanDrop

This component implements the 'IDroppable' interface, and will fire events when you drop something on it.


GameObjectLeanFingerEvent
OnDropped

Called on the first frame the conditions are met.

GameObject = The GameObject instance this was dropped.

LeanFinger = The LeanFinger instance this was used to drop the specified GameObject.




LeanDropCount

This component implements the 'IDroppable' interface, and will count the amount of times you drop a GameObject with the LeanSelectableDrop component on it.


int
Count

The amount of times you've dropped an object on this.



IntEvent
OnCount

When the amount of selected objects changes, this event is invoked with the current count.



int
MatchMin

The minimum amount of objects that must be selected for a match.

-1 = Max.



int
MatchMax

The maximum amount of objects that can be selected for a match.

-1 = Max.



UnityEvent
OnMatch

When the amount of selected objects matches the RequiredCount, this event will be invoked.



UnityEvent
OnUnmatch

When the amount of selected objects no longer matches the RequiredCount, this event will be invoked.




LeanFingerDownCanvas

This component works like LeanFingerDown, but only for the UI element this component is attached to.

NOTE  This requires you to enable the RaycastTarget setting on your UI graphic.


LeanFingerFlick

This component detects swipes while the finger is touching the screen.


bool
IgnoreStartedOverGui

Ignore fingers with StartedOverGui?



bool
IgnoreIsOverGui

Ignore fingers with OverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



CheckType
Check

This allows you to choose how the flick will be detected.

Default = Detects one flick within the current TapThreshold time.

IgnoreAge = You can hold the finger for any duration before flicking.

Multiple = You can stop moving the finger for TapThreshold seconds and perform additional flicks.




LeanFingerHeld

This component fires events if a finger has been held for a certain amount of time without moving.


bool
IgnoreStartedOverGui

Ignore fingers with StartedOverGui?



bool
IgnoreIsOverGui

Ignore fingers with OverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



float
MinimumAge

The finger must be held for this many seconds.



float
MaximumMovement

The finger cannot move more than this many pixels relative to the reference DPI.



LeanFingerEvent
OnFingerDown

Called on the first frame the conditions are met.



LeanFingerEvent
OnFingerUpdate

Called on every frame the conditions are met.



LeanFingerEvent
OnFingerUp

Called on the last frame the conditions are met.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorldDown

Called on the first frame the conditions are met.

Vector3 = Start point based on the ScreenDepth settings.



Vector3Event
OnWorldUpdate

Called on the first frame the conditions are met.

Vector3 = Current point based on the ScreenDepth settings.



Vector3Event
OnWorldUp

Called on the first frame the conditions are met.

Vector3 = End point based on the ScreenDepth settings.




LeanFingerHeldCanvas LeanFingerHeld

This component works like LeanFingerHeld, but only for the UI element this component is attached to.



LeanFingerTapExpired

This component works like OnFingerTap, but it will only call events when a finger you've tapped has 'expired'. This allows you to discern between single/double/etc taps.



LeanFingerTapQuick

This component allows you to detect when a finger begins touching the screen after it's done a specific amount of taps. This creates the effect of instantly detecting this tap.

NOTE  This component can only be used to detect the last tap.

For example, if you want to detect single and double taps, then this component can only be used to detect double taps.

If you want to detect prior taps, then you must use the LeanFingerTapExpired component.

The reason for this is because this component instantly triggers when you begin touching the screen, so it cannot know how many times you will tap after.


bool
IgnoreStartedOverGui

Ignore fingers with StartedOverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



int
RequiredTapCount

How many taps must the finger have already performed?

1 = One previous tap, making this component detect the second quick tap.



LeanFingerEvent
OnFinger

Called on the first frame the conditions are met.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorld

Called on the first frame the conditions are met.

Vector3 = Start point based on the ScreenDepth settings.



Vector2Event
OnScreen

Called on the first frame the conditions are met.

Vector2 = Screen position.




LeanFirstDown

This component allows you to detect when the first finger begins touching the screen.


bool
IgnoreStartedOverGui

Ignore fingers with StartedOverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



LeanFingerEvent
OnFinger

This event will be called if the above conditions are met when you first touch the screen.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorld

This event will be called if the above conditions are met when you first touch the screen.

Vector3 = Finger position in world space.



Vector2Event
OnScreen

This event will be called if the above conditions are met when you first touch the screen.

Vector2 = Finger position in screen space.




LeanFirstDownCanvas LeanFirstDown

This component allows you to detect when the first finger begins touching the current UI element.

NOTE  This requires you to enable the RaycastTarget setting on your UI graphic.


LeanGestureToggle

This component will enable/disable the target pinch and twist components based on total pinch and twist gestures, like mobile map applications.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



bool
EnableWithoutIsolation

If one specific gesture hasn't been isolated yet, keep them all enabled?



MonoBehaviour
DragComponent

The component that will be enabled/disabled when dragging.



float
DragThreshold

The amount of drag required to enable dragging mode.



MonoBehaviour
PinchComponent

The component that will be enabled/disabled when pinching.



float
PinchThreshold

The amount of pinch required to enable twisting in scale (e.g. 0.1 = 0.9 to 1.1).



MonoBehaviour
TwistComponent

The component that will be enabled/disabled when twisting.



float
TwistThreshold

The amount of twist required to enable twisting in degrees.



bool
TwistWithPinch

Enable twist component when pinch component is activated?



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanLastUp

This component allows you to detect when the last finger stops touching the screen.


bool
IgnoreStartedOverGui

Ignore fingers with StartedOverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



LeanFingerEvent
OnFinger

This event will be called if the above conditions are met when you finish touching the screen.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorld

This event will be called if the above conditions are met when you finish touching the screen.

Vector2 = Finger position in world space.



Vector2Event
OnScreen

This event will be called if the above conditions are met when you finish touching the screen.

Vector2 = Finger position in screen space.




LeanLastUpCanvas LeanLastUp

This component allows you to detect when the last finger stops touching the current UI element.

NOTE  This requires you to enable the RaycastTarget setting on your UI graphic.


LeanManualFlick

This component works like LeanFingerSwipe, but you must manually add fingers from components like LeanFingerDown, LeanFingerDownCanvas, etc.


bool
IgnoreIsOverGui

Ignore fingers with OverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



CheckType
Check

This allows you to choose how the flick will be detected.

Default = Detects one flick within the current TapThreshold time.

IgnoreAge = You can hold the finger for any duration before flicking.

Multiple = You can stop moving the finger for TapThreshold seconds and perform additional flicks.



void
AddFinger
LeanFinger finger

This method allows you to manually add a finger.



void
RemoveFinger
LeanFinger finger

This method allows you to manually remove a finger.




LeanManualSwipe

This component works like LeanFingerSwipe, but you must manually add fingers from components like LeanFingerDown, LeanFingerDownCanvas, etc.


bool
IgnoreIsOverGui

Ignore fingers with OverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



void
AddFinger
LeanFinger finger

This method allows you to manually add a finger.



void
RemoveFinger
LeanFinger finger

This method allows you to manually remove a finger.




LeanMouseWheel

This component allows you to add mouse wheel control to other components.


LeanSelectable
RequiredSelectable

Do nothing if this LeanSelectable isn't selected?



int
RequiredMouseButton

When using simulated fingers, should they be created from a specific mouse button?

-1 = Ignore.

0 = Left Mouse.

1 = Right Mouse.

2 = Middle Mouse.



ModifyType
Modify

Should the scroll delta be modified before use?

Sign = The swipe delta will either be 1 or -1.



float
Multiplier

This final delta value will be multiplied by this.



CoordinateType
Coordinate

The coordinate space of the output delta values.

ZeroBased = Scrolling where 0 means no scroll.

OneBased = ZeroBased + 1. Scrolling where 1 means no scroll. This is suitable for use with components where you multiply a value.



FloatEvent
OnDelta

Called when the mouse scrolls.

Float = Scroll delta.




LeanMultiDirection

This component allows you to detect how far one or many fingers move in a specific direction across screen.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



bool
IgnoreIfStatic

If there is no movement, ignore it?



float
Angle

The angle we want to detect movement along.

0 = Up.

90 = Right.

180 = Down.

270 = Left.



bool
OneWay

Set delta to 0 if it goes negative?



CoordinateType
Coordinate

The coordinate space of the OnDelta values.



float
Multiplier

The swipe delta will be multiplied by this value.



FloatEvent
OnDelta

This event is invoked when the requirements are met.

Float = Position Delta based on your Coordinate setting.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanMultiDown

This component allows you to detect when a specific amount of fingers begin touching the screen.


bool
IgnoreStartedOverGui

Ignore fingers with StartedOverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



int
RequiredCount

The amount of fingers we are interested in.



LeanFingerListEvent
OnFingers

This event will be called if the above conditions are met when you first touch the screen.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorld

This event will be called if the above conditions are met when you first touch the screen.

Vector3 = Finger position in world space.



Vector2Event
OnScreen

This event will be called if the above conditions are met when you first touch the screen.

Vector2 = Finger position in screen space.




LeanMultiHeld

This component allows you to detect when a specific amount of fingers begin touching the screen.


bool
IgnoreStartedOverGui

Ignore fingers with StartedOverGui?



bool
IgnoreIsOverGui

Ignore fingers with OverGui?



LeanSelectable
RequiredSelectable

If the specified object is set and isn't selected, then this component will do nothing.



int
RequiredCount

The amount of fingers we are interested in.



float
MinimumAge

The finger must be held for this many seconds.



float
MaximumMovement

The finger cannot move more than this many pixels relative to the reference DPI.



LeanFingerListEvent
OnFingersDown

This event will be called if the above conditions are met when you begin holding fingers down.



LeanFingerListEvent
OnFingersUpdate

This event will be called if the above conditions are met when you begin holding fingers down.



LeanFingerListEvent
OnFingersUp

This event will be called if the above conditions are no longer met.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorldDown

This event will be called if the above conditions are met when you first touch the screen.

Vector3 = Finger position in world space.



Vector3Event
OnWorldUpdate

This event will be called if the above conditions are met when you first touch the screen.

Vector3 = Finger position in world space.



Vector3Event
OnWorldUp

This event will be called if the above conditions are met when you first touch the screen.

Vector3 = Finger position in world space.



Vector2Event
OnScreenDown

This event will be called if the above conditions are met when you first touch the screen.

Vector2 = Finger position in screen space.



Vector2Event
OnScreenUpdate

This event will be called if the above conditions are met when you first touch the screen.

Vector2 = Finger position in screen space.



Vector2Event
OnScreenUp

This event will be called if the above conditions are met when you first touch the screen.

Vector2 = Finger position in screen space.




LeanMultiPinch

This component allows you to get the pinch of all fingers.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



bool
IgnoreIfStatic

If there is no pinching, ignore it?



CoordinateType
Coordinate

OneBasedScale = Scale (1 = no change, 2 = double size, 0.5 = half size).

OneBasedReciprocal = 1 / Scale (1 = no change, 2 = half size, 0.5 = double size).

ZeroBasedScale = Scale - 1 (0 = no change, 1 = double size, -0.5 = half size).

ZeroBasedRatio = 1 / Scale - 1 (0 = no change, 1 = half size, -0.5 = double size).

ZeroBasedDistance = Linear change in distance (0 = no change, 10 = 10 pixel larger radius, -10 = 10 pixel smaller radius).



float
Multiplier

The swipe delta will be multiplied by this value.



FloatEvent
OnPinch

This event is invoked when the requirements are met.

Float = Pinch value based on your Scale setting.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanMultiPull

This component allows you to perform a continuous action based on the current position of the fingers relative to where they started.

This allows you to perform actions like an invisible joystick.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



CoordinateType
Coordinate

The coordinate space of the OnDelta values.



float
Multiplier

The delta values will be multiplied by this when output.



bool
ScaleByTime

If you enable this then the delta values will be multiplied by Time.deltaTime. This allows you to maintain frame rate independent actions.



Vector2Event
OnVector

This event is invoked when the requirements are met.

Vector2 = Position Delta based on your Delta setting.



FloatEvent
OnDistance

Called on the first frame the conditions are met.

Float = The distance/magnitude/length of the swipe delta vector.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorldFrom

Called on the first frame the conditions are met.

Vector3 = Start point in world space.



Vector3Event
OnWorldTo

Called on the first frame the conditions are met.

Vector3 = End point in world space.



Vector3Event
OnWorldDelta

Called on the first frame the conditions are met.

Vector3 = The vector between the start and end points in world space.



Vector3Vector3Event
OnWorldFromTo

Called on the first frame the conditions are met.

Vector3 = Start point in world space.

Vector3 = End point in world space.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanMultiSwipe

This script calculates the multi-swipe event.

A multi-swipe is where you swipe multiple fingers at the same time, and OnSwipe gets called when the first finger is released from the screen.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



float
ScaledDistanceThreshold

Each finger touching the screen must have moved at least this distance for a multi swipe to be considered. This prevents the scenario where multiple fingers are touching, but only one swipes.



float
ParallelAngleThreshold

This allows you to set the maximum angle between parallel swiping fingers for the OnSwipeParallel event to be fired.



float
PinchScaledDistanceThreshold

This allows you to set the minimum pinch distance for the OnSwipeIn and OnSwipeOut events to be fired.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanMultiTap

This script calculates the multi-tap event.

A multi-tap is where you press and release at least one finger at the same time.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



UnityEvent
OnTap

Called when a multi-tap occurs.



IntEvent
OnCount

Called when a multi-tap occurs.

Int = The amount of times you've multi-tapped.



IntEvent
OnHighest

Called when a multi-tap occurs.

Int = The maximum amount of fingers involved in this multi-tap.



IntIntEvent
OnCountHighest

Called when a multi-tap occurs.

Int = The amount of times you've multi-tapped.

Int = The maximum amount of fingers involved in this multi-tap.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanMultiTwist

This component allows you to get the twist of all fingers.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



bool
IgnoreIfStatic

If there is no twisting, ignore the events?



OneFingerType
OneFinger

Should this component allow one finger twisting?

ScreenCenter = The twist pivot point will be the center of the screen.

FingerStart = The twist pivot point will be the finger start position.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanMultiUp

This component allows you to detect when a specific amount of fingers stop touching the screen.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



LeanFingerEvent
OnFinger

This event will be called if the above conditions are met when your finger stops touching the screen.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorld

This event will be called if the above conditions are met when your finger stops touching the screen.

Vector3 = Finger position in world space.



Vector2Event
OnScreen

This event will be called if the above conditions are met when your finger stops touching the screen.

Vector2 = Finger position in screen space.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanMultiUpdate

This component allows you to get the change in position of all specified fingers.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



bool
IgnoreIfStatic

If the fingers didn't move, skip calling



LeanFingerListEvent
OnFingers

This event is invoked when the requirements are met.

List = The fingers that are touching the screen.



CoordinateType
Coordinate

The coordinate space of the OnDelta values.



ConstrainType
Constrain

Should the delta values be locked to the horizontal or vertical axes?

HorizontalOrVertical1 = This component won't output any delta until the finger(s) have moved more than Threshold scaled pixels.

HorizontalOrVertical2 = This component will output normal delta values until the finger(s) have moved more than Threshold scaled pixels.



float
ConstrainThreshold

This finger(s) must move this many scaled pixels for the constraint to begin.



float
Multiplier

The delta values will be multiplied by this when output.



Vector2Event
OnDelta

This event is invoked when the requirements are met.

Vector2 = Position Delta based on your Delta setting.



FloatEvent
OnDistance

Called on the first frame the conditions are met.

Float = The distance/magnitude/length of the swipe delta vector.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorldFrom

Called on the first frame the conditions are met.

Vector3 = Start point in world space.



Vector3Event
OnWorldTo

Called on the first frame the conditions are met.

Vector3 = End point in world space.



Vector3Event
OnWorldDelta

Called on the first frame the conditions are met.

Vector3 = The vector between the start and end points in world space.



Vector3Vector3Event
OnWorldFromTo

Called on the first frame the conditions are met.

Vector3 = Start point in world space.

Vector3 = End point in world space.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanMultiUpdateCanvas LeanMultiUpdate

This component allows you to perform events while fingers are on top of the current UI element.


bool
IgnoreIfOff

If a finger is currently off the current UI element, ignore it?




LeanPick

This component can be used to pick objects in your scene that have the LeanPickable component attached.

NOTE  This component requires you to call the SelectScreenPosition method externally (e.g. using the LeanFingerTap component).

string
RequiredTag

The tag required for an object to be selected.



LeanPickableEvent
OnPickable

This event will be invoked when an object is picked.



void
PickStartScreenPosition
LeanFinger finger

This method allows you to pick at the finger's StartScreenPosition.

NOTE  This method be called from somewhere for this component to work (e.g. LeanFingerTap).


void
PickScreenPosition
LeanFinger finger

This method allows you to pick at the finger's current ScreenPosition.

NOTE  This method be called from somewhere for this component to work (e.g. LeanFingerTap).


void
SelectScreenPosition
LeanFinger finger, Vector2 screenPosition

This method allows you to initiate selection of a finger at a custom screen position.

NOTE  This method be called from a custom script for this component to work.



LeanPickable

This component allows you to detect when a finger presses/taps on top of the current GameObject without using the LeanSelectable system.

NOTE  This feature requires your scene to contain the LeanPick component.

LeanFingerEvent
OnFinger

This event will be invoked when the specified finger touches this GameObject.



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



Vector3Event
OnWorld

This event will be invoked when this object is picked, and tell you the world space position it touched.



Vector2Event
OnScreen

This event will be invoked when this object is picked, and tell you the screen space position it touched.




LeanPinchCamera

This component allows you to zoom a camera in and out based on the pinch gesture

This supports both perspective and orthographic cameras


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



Camera
Camera

The camera this component will calculate using.

None = MainCamera.



float
Zoom

The current FOV/Size.



float
Damping

If you want this component to change smoothly over time, then this allows you to control how quick the changes reach their target value.

-1 = Instantly change.

1 = Slowly change.

10 = Quickly change.



bool
Clamp

Limit the FOV/Size?



float
ClampMin

The minimum FOV/Size we want to zoom to.



float
ClampMax

The maximum FOV/Size we want to zoom to.



bool
Relative

Should the zoom be performed relative to the finger center?



bool
IgnoreZ

Ignore changes in Z translation for 2D?



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



void
MultiplyZoom
float scale

This method allows you to multiply the current Zoom value by the specified scale. This is useful for quickly changing the zoom from UI button clicks, or LeanMouseWheel scrolling.



void
IncrementZoom
float delta

This method allows you to multiply the current Zoom value by the specified delta. This works like MultiplyZoom, except a value of 0 will result in no change, -1 will halve the zoom, 2 will double the zoom, etc.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanReplayFinger

This shows you how to record a finger's movement data that can later be replayed.


Transform
Cursor

The cursor used to show the recording.



LeanScreenDepth
ScreenDepth

The conversion method used to find a world point from a screen point.



bool
Playing

Is the recording playing?



float
PlayTime

The position of the playback in seconds.




LeanSelectableBlock

This component shows you a basic implementation of a block in a match-3 style game.


int
X

Current X grid coordinate of this block.



int
Y

Current Y grid coordinate of this block.



float
BlockSize

The size of the block in world space.



bool
DeselectOnSwap

Auto deselect this block when swapping?



float
Damping

If you want this component to change smoothly over time, then this allows you to control how quick the changes reach their target value.

-1 = Instantly change.

1 = Slowly change.

10 = Quickly change.




LeanSelectableCenter

This component can calculate the average position of all selected objects in the scene.

NOTE  You must manually call the Calculate method from somewhere (e.g. inspector event), then it will be output from the OnPosition event.

Vector3Event
OnPosition

This allows you to output Seconds to UI text.



void
Calculate

This method will calculate the position and output it using the OnPosition event.




LeanSelectableDial

This script allows you to twist the selected object around like a dial or knob.


Camera
Camera

The camera this component will calculate using.

None/null = MainCamera.



Vector3
Tilt

The base rotation in local space.



Vector3
Axis

The axis of the rotation in local space.



float
Angle

The angle of the dial in degrees.



bool
Clamp

Should the Angle value be clamped?



float
ClampMin

The minimum Angle value.



float
ClampMax

The maximum Angle value.



List<Trigger>
Triggers

This allows you to perform a custom event when the dial is within a specified angle range.



FloatEvent
OnAngleChanged

This event is invoked when the Angle changes.

Float = Current Angle.



void
IncrementAngle
float delta

This method allows you to increase the Angle value from an external event (e.g. UI button click).




LeanSelectableDragTorque

This script will add torque to the attached Rigidbody based on finger spin gestures.


Camera
Camera

The camera this component will calculate using.

None/null = MainCamera.



float
Force

The torque force multiplier.




LeanSelectableDrop

This script allows you to change the color of the SpriteRenderer attached to the current GameObject.


IgnoreType
Ignore

When this object is dropped, should its GameObject layer be temporarily switched to IgnoreRaycast, so the drop can pass through it?

None = Make no changes.

ThisGameObject = Change this GameObject's layer only.

ThisGameObjectAndAncestors = Change this GameObject and its ancestors's layers.



GameObjectEvent
OnGameObject

Called on the first frame the conditions are met.

GameObject = The GameObject instance this was dropped on.



IDropHandlerEvent
OnDropHandler

Called on the first frame the conditions are met.

IDropHandler = The IDropHandler instance this was dropped on.




LeanSelectablePressureScale

This component scales the current selectable based on the selecting finger pressure.


Vector3
BaseScale

The default scale with no pressure.



float
PressureMultiplier

The amount BaseScale gets multiplied based on the finger pressure.



bool
PressureClamp

Limit pressure to a range of 0..1?




LeanSelectableSelected

This component fires events when the selectable has been selected for a certain amount of time.


float
Threshold

The finger must be held for this many seconds.



ResetType
Reset

When should Seconds be reset to 0?



bool
RawSelection

Bypass LeanSelectable.HideWithFinger?



bool
RequireFinger

If the selecting finger went up, cancel timer?



SelectableEvent
OnSelectableDown

Called on the first frame the conditions are met.



SelectableEvent
OnSelectableUpdate

Called on every frame the conditions are met.



SelectableEvent
OnSelectableUp

Called on the last frame the conditions are met.




LeanSelectableTime

This component counts how many seconds this LeanSelectable has been selected and sends it out via event.


SendType
Send

This allows you to control when the events will be invoked.

WhileSelected = Every frame while this object is selected.

WhileSelectedAndWhenDeselected = Every frame while this object is selected, and the first frame it gets deselected.

Always = Every frame, regardless of the selection.



FloatEvent
OnSeconds

Based on the Send setting, this event will be invoked.

Float = Seconds selected.




LeanSelectionBox

This component will draw a selection box.


Camera
Camera

The camera this component will calculate using.

None/null = MainCamera.



bool
IgnoreIfStartedOverGui

Ignore fingers with StartedOverGui?



RectTransform
Prefab

The selection box prefab.



RectTransform
Root

The transform the prefabs will be spawned on.

NOTE  This RectTransform must fill the whole screen, like the main canvas.


LeanSelectByFinger
Select

The selected objects will be selected by this component.



LayerMask
RequiredLayers

For an object to be selected, it must be in one of these layers.



List<string>
RequiredTags

For an object to be selected, it must have one of these tags.




LeanShape

This component allows you to define a shape using 2D points.


bool
ConnectEnds

Should the start and end points of this shape be connected, forming a loop?



LineRenderer
Visual

If you want to visualize the shape, you can specify an output LineRenderer here.



List<Vector2>
Points

The points that define the shape.




LeanShapeDetector

This component allows you to detect


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



LeanShape
Shape

The shape we want to detect.



float
StepThreshold

The finger must move at least this many scaled pixels for it to record a new point.



float
DistanceThreshold

The drawn shape must be within this distance of the reference shape to be recognized. This is in local space relative to the reference shape.



float
ErrorThreshold

If you draw outside the DistanceThreshold, the error factor will increase based on how far you stray, until eventually the shape fails to detect. This allows you to set how high the error factor can become before the detection fails.



int
MinimumPoints

If you want to allow partial shape matches, then specify the minimum amount of edges that must be matched in the shape.



DirectionType
Direction

Which direction should the shape be checked using?



LeanFingerEvent
OnDetected

If the finger goes up and it has traced the specified shape, this event will be invoked with the finger data.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanSpawnWithFinger

This component allows you to spawn a prefab at a point relative to a finger and the specified ScreenDepth.

NOTE  To trigger the prefab spawn you must call the Spawn method on this component from somewhere.

Transform
Prefab

The prefab that this component can spawn.



RotateType
RotateTo

How should the spawned prefab be rotated?



bool
DragAfterSpawn

Hold on to the spawned clone while the spawning finger is still being held?



bool
DestroyIfBlocked

If the spawned object is dropped on top of the wrong GameObject (e.g. UI), destroy it?



bool
DestroyIfMissing

If the spawned object isn't dropped on top of the specified GameObjects, destroy it?



bool
SelectOnSpawn

If the specified prefab is selectable, select it when spawned?



LeanSelect
SelectWith

If you want the spawned component to be a selected with a specific select component, you can specify it here.

None/null = It will be self selected.



bool
DeselectOnUp

If the selecting finger goes up, deselect the object?



LeanScreenDepth
ScreenDepth

The conversion method used to find a world point from a screen point.



Vector2
PixelOffset

This allows you to offset the finger position.



Canvas
PixelScale

If you want the pixels to scale based on device resolution, then specify the canvas whose scale you want to use here.



Vector3
WorldOffset

This allows you to offset the spawned object position.



Transform
WorldRelativeTo

This allows you transform the WorldOffset to be relative to the specified Transform.



void
Spawn
LeanFinger finger

This will spawn Prefab at the specified finger based on the ScreenDepth setting.




LeanSwipeEdge

This component allows you to detect when a finger swipes from the edge of the screen.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



bool
Left

Detect swipes coming from the left edge?



bool
Right

Detect swipes coming from the right edge?



bool
Bottom

Detect swipes coming from the bottom edge?



bool
Top

Detect swipes coming from the top edge?



float
AngleThreshold

If the swipe angle is off by this many degrees, it will be ignored.

0 = Must be exactly parallel.



float
EdgeThreshold

The swipe must begin within this many scaled pixels of the edge of the screen.



void
CheckBetween
Vector2 from, Vector2 to

If you've set Use to ManuallyAddedFingers, then you can call this method to manually check for a swipe.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




LeanTwistCamera

This component allows you to rotate the current GameObject using a twist gesture.


LeanFingerFilter
Use

The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.



float
Damping

If you want this component to change smoothly over time, then this allows you to control how quick the changes reach their target value.

-1 = Instantly change.

1 = Slowly change.

10 = Quickly change.



bool
Relative

Should the rotation be performed relative to the finger center?



LeanScreenDepth
ScreenDepth

The method used to find world coordinates from a finger. See LeanScreenDepth documentation for more information.



void
AddFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.



void
RemoveFinger
LeanFinger finger

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.



void
RemoveAllFingers

If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.




Index

What is Lean Touch+?

How do I get started?

What Examples Are Included?



Assets

Lean Touch

Lean Touch+

Lean Localization

Lean Pool

Lean Transition

Lean GUI

Lean GUI Shapes

Lean Texture

Lean Texture+

Spaceships - Build & Destroy

Modular Backgrounds

Paint in 3D

Paint in 2D

Paint in Editor

FLOW

Destructible 2D

Space Graphics Toolkit

Space Graphics Planets

Volumetric Audio



Versions

3.1.0

3.0.2

3.0.1

3.0.0

2.3.5

2.3.4

2.3.3

2.3.2

2.3.1

2.3.0

2.2.4

2.2.3

2.2.2

2.2.1

2.2.0

2.1.9

2.1.8

2.1.7

2.1.6

2.1.5

2.1.4

2.1.3

2.1.2

2.1.1

2.1.0

2.0.9

2.0.8

2.0.7

2.0.6

2.0.5

2.0.4

2.0.3

2.0.2

2.0.1

2.0.0



Components

IDropHandler

LeanDragColorMesh

LeanDragDeformMesh

LeanDragLine

LeanDragSelect

LeanDragTranslateAlong

LeanDragTranslateAlongRigidbody

LeanDragTranslateRigidbody

LeanDragTranslateRigidbody2D

LeanDrop

LeanDropCount

LeanFingerDownCanvas

LeanFingerFlick

LeanFingerHeld

LeanFingerHeldCanvas

LeanFingerTapExpired

LeanFingerTapQuick

LeanFirstDown

LeanFirstDownCanvas

LeanGestureToggle

LeanLastUp

LeanLastUpCanvas

LeanManualFlick

LeanManualSwipe

LeanMouseWheel

LeanMultiDirection

LeanMultiDown

LeanMultiHeld

LeanMultiPinch

LeanMultiPull

LeanMultiSwipe

LeanMultiTap

LeanMultiTwist

LeanMultiUp

LeanMultiUpdate

LeanMultiUpdateCanvas

LeanPick

LeanPickable

LeanPinchCamera

LeanReplayFinger

LeanSelectableBlock

LeanSelectableCenter

LeanSelectableDial

LeanSelectableDragTorque

LeanSelectableDrop

LeanSelectablePressureScale

LeanSelectableSelected

LeanSelectableTime

LeanSelectionBox

LeanShape

LeanShapeDetector

LeanSpawnWithFinger

LeanSwipeEdge

LeanTwistCamera