Lean Common


DOCUMENTATION

What is Lean Common?

Lean Common is a lightweight collection of scripts and media used by all Lean assets.







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


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!


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.


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.


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 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 GUI Shapes

Lean GUI Shapes

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


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!


Planet Pack - Space Graphics Toolkit

Planet Pack - Space Graphics Toolkit

This pack contains 26 high detail PBR planets, all finished using the powerful planet features of Space Graphics Toolkit (SGT). This is a standalone package, so SGT is not required. You can even use the included features to turn your own planets into beautiful worlds!


Lean Touch+

Lean Touch+

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


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

1.0.1

Updated LeanEditor to support inspectors based on SerializedProperty.



1.0.0

Initial version.







Components

LeanEditor

This is the base class for all inspectors.



LeanHelper

This class contains useful methods used in almost all LeanTouch code.


static GameObject
CreateAsset
string name

This method creates an empty GameObject prefab at the current asset folder



static T
CreateElement<T>
Transform parent

This method allows you to create a UI element with the specified component and specified parent, with behavior consistent with Unity's built-in UI element creation.



static float
GetDampenFactor
float damping, float elapsed

This method gives you the time-independent 't' value for lerp when used for dampening. This returns 1 in edit mode, or if dampening is less than 0.



static T
Destroy<T>
T o

This method allows you to destroy the target object in game and in edit mode, and it returns null.



static T
GetObjectFromSerializedProperty<T>
object target, SerializedProperty property

This method gives you the actual object behind a SerializedProperty given to you by a property drawer.




LeanInput

This class wraps UnityEngine.Input and UnityEngine.InputSystem so they can both be used from the same interface.



LeanDestroy

This component allows you to destroy a GameObject.


ExecuteType
Execute

This allows you to control when the Target GameObject will be destroyed.

OnFirstFrame = As soon as Update runs (this component must be enabled).

AfterDelay = After the specified amount of Seconds has elapsed.

AfterDelayUnscaled = The same as AfterDelay, but using unscaledDeltaTime.

Manually = You must manually call the DestroyNow method.



GameObject
Target

The GameObject that will be destroyed.

None/null = This GameObject.



float
Seconds

The amount of seconds remaining until the GameObject is destroyed.



void
DestroyNow

You can manually call this method to destroy the specified GameObject immediately.




LeanFormatString

This component allows you to convert values like ints and floats into formatted text that can be shown in the UI. To use this component, simply call one of the SetString methods, and it will output the formatted string to the OnString event, which can be connected to UI text, etc.


string
Format

The final text will use this string formatting, where {0} is the first value, {1} is the second, etc. Formatting uses standard string.Format style.



StringEvent
OnString

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

String = The .



void
SetString
string a

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
string a, string b

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
int a

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
int a, int b

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
float a

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
float a, float b

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
Vector2 a

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
Vector2 a, Vector2 b

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
Vector3 a

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
Vector3 a, Vector3 b

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
Vector4 a

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
Vector4 a, Vector4 b

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
float a, int b

This method will convert the input arguments into a formatted string, and output it to the OnString event.



void
SetString
int a, float b

This method will convert the input arguments into a formatted string, and output it to the OnString event.




LeanPath

This component stores a list of points that form a path.


List<Vector3>
Points

The points along the path.



bool
Loop

Do these points loop back to the start?



Space
Space

The coordinate system for the points.



int
Smoothing

The amount of lines between each path point when read from LeanScreenDepth.



LineRenderer
Visual

This allows you to draw a visual of the path using a LineRenderer.




LeanPlane

This component stores information about a 3D plane. By default this plane lays on the XY axis, or faces the Z axis.


bool
ClampX

Should the plane be clamped on the x axis?



bool
ClampY

Should the plane be clamped on the y axis?



float
SnapX

The distance between each position snap on the x axis.



float
SnapY

The distance between each position snap on the x axis.




LeanRoll

This component rotates the current GameObject based on the current Angle value.

NOTE  This component overrides and takes over the rotation of this GameObject, so you can no longer externally influence it.

float
Angle

The current angle in degrees.



bool
Clamp

Should the Angle value be clamped?



float
ClampMin

The minimum Angle value.



float
ClampMax

The maximum Angle value.



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
IncrementAngle
float delta

The Angle value will be incremented by the specified angle in degrees.



void
DecrementAngle
float delta

The Angle value will be decremented by the specified angle in degrees.



void
RotateToDelta
Vector2 delta

This method will update the Angle value based on the specified vector.



void
SnapToTarget

This method will immediately snap the current angle to its target value.




LeanSelect

This is the base class for all object selectors.


bool
DeselectWithNothing

If you attempt to select a point that has no objects underneath, should all currently selected objects be deselected?



LimitType
Limit

If you have selected the maximum number of objects, what should happen?

Unlimited = Always allow selection.

StopAtMax = Allow selection up to the MaxSelectables count, then do nothing.

DeselectFirst = Always allow selection, but deselect the first object when the MaxSelectables count is reached.



int
MaxSelectables

The maximum number of selectables that can be selected at the same time.

0 = Unlimited.



ReselectType
Reselect

If you select an already selected selectable, what should happen?



List<LeanSelectable>
Selectables

This stores all objects selected by this component.



LeanSelectableEvent
OnSelected

This is invoked when an object is selected.



LeanSelectableEvent
OnDeselected

This is invoked when an object is deselected.



UnityEvent
OnNothing

This is invoked when you try to select, but nothing is found.



void
Select
LeanSelectable selectable

This will select the specified object and add it to this component's Selectables list, if it isn't already there.



void
Deselect
LeanSelectable selectable

This remove the specified object from this component's Selectables list if present, and deselect it.



void
DeselectAll

This will deselect all objects that were selected by this component.



void
Cull
int maxCount

This will deselect objects in chronological order until the selected object count reaches the specified amount.




LeanSelectable

This component allows you make the current GameObject selectable.


UnityEvent
OnSelected

This is invoked every time this object is selected.

NOTE  This may occur multiple times.


UnityEvent
OnDeselected

This is invoked every time this object is deselected.

NOTE  This may occur multiple times.


int
SelectedCount

This will tell you how many LeanSelect components in the scene currently have this object selected.



bool
IsSelected

This will tell you if this object is self selected, or selected by any LeanSelect components in the scene.



static void
DeselectAll

This deselects all objects in the scene.




LeanSelectableBehaviour

This is the base class for all components that need to implement some kind of special logic when selected. You can do this manually without this class, but this makes it much easier.

NOTE  This component will register and unregister the associated LeanSelectable in OnEnable and OnDisable.

LeanSelectable
Selectable

This tells you which LeanSelectable is currently associated with this component.



void
Register

This method allows you to manually register the LeanSelectable this component is associated with. This is useful if you're manually spawning and attaching children from code.



void
Register
LeanSelectable newSelectable

This method allows you to manually register the LeanSelectable this component is associated with.



void
Unregister

This method allows you to manually register the LeanSelectable this component is associated with. This is useful if you're changing the associated LeanSelectable.




LeanSelectableGraphicColor

This component allows you to change the color of the Graphic (e.g. Image) attached to the current GameObject when selected.


Color
DefaultColor

The default color given to the SpriteRenderer.



Color
SelectedColor

The color given to the SpriteRenderer when selected.




LeanSelectableRendererColor

This component allows you to change the color of the Renderer (e.g. MeshRenderer) attached to the current GameObject when selected.


Color
DefaultColor

The default color given to the SpriteRenderer.



Color
SelectedColor

The color given to the SpriteRenderer when selected.




LeanSelectableSpriteRendererColor

This component allows you to change the color of the SpriteRenderer attached to the current GameObject when selected.


Color
DefaultColor

The default color given to the SpriteRenderer.



Color
SelectedColor

The color given to the SpriteRenderer when selected.




LeanSpawn

This component allows you to spawn a prefab at the specified world point.

NOTE  For this component to work you must manually call the Spawn method from somewhere.

Transform
Prefab

The prefab that this component can spawn.



SourceType
DefaultPosition

If you call Spawn(), where should the position come from?



SourceType
DefaultRotation

If you call Spawn(), where should the rotation come from?



void
Spawn

This will spawn Prefab at the current Transform.position.



void
Spawn
Vector3 position

This will spawn Prefab at the specified position in world space.




LeanDemo

This component is used by all the demo scenes to perform common tasks. Including modifying the current scene to make it look consistent between different rendering pipelines.


bool
UpgradeInputModule

If you enable this setting and your project is running with the new InputSystem then the EventSystem's InputModule component will be upgraded.



Transform
SkyboxRoot

If you set this then the specified skybox will be placed on top of the main camera.




LeanLinkTo

This component turns the current UI element into a button that will perform a common action you specify.


LinkType
Link

The action that will be performed when clicked.




Index

What is Lean Common?



Assets

Lean GUI

Lean Transition

Paint in 3D

Lean Pool

Space Graphics Toolkit

Lean Touch

Lean Localization

Lean GUI Shapes

Destructible 2D

Planet Pack - Space Graphics Toolkit

Lean Touch+

Volumetric Audio



Versions

1.0.1

1.0.0



Components

LeanEditor

LeanHelper

LeanInput

LeanDestroy

LeanFormatString

LeanPath

LeanPlane

LeanRoll

LeanSelect

LeanSelectable

LeanSelectableBehaviour

LeanSelectableGraphicColor

LeanSelectableRendererColor

LeanSelectableSpriteRendererColor

LeanSpawn

LeanDemo

LeanLinkTo