Documentation

Overview

Add a SpriteTrail component to the scene object contains SpriteRenderer.

SpriteTrail/Scripts/SpriteTrail.cs

By adding this component to the GameObject that contains the SpriteRenderer can make trail of sprite.

 

Components

SpriteTrail.cs

The Light2DSource component has following options.

PropertyFunction
MethodSet to Time to emit trail at specific interval or Distance to emit trail at specific distance.
SpacingProperty to set sprite spacing distance.
IntervalProperty that sets the sprite emitted seconds.
Only When MovedIf checked, accumulates time only when the object is moved.
LifeTimeDefine the lifetime of the trail, measured in seconds.
Color over LifeTimeColor and Alpha changes during lifetime.
Color TypeStatic color or Gradient color during lifetime.
ColorStatic color during lifetime.
Alpha Multiplier CurveAlpha multiplication during lifetime.
GradientCurve of change in color and alpha values over a lifetime.
Scale MultiplierScale multiplication changes during lifetime.
Vector2Scale multiplication of the original SpriteRenderer.
Scale on X, YScale multiplication curve over a lifetime.
Override MaterialMaterial of the trail. If it is empty the material used by the SpriteRenderer.
Hide In HierachyHide trail objects in Hierachy. (Recommended)
Remove On DisabledAs soon as the object is enabled, it prepares to create a trail. If it is not checked, call Play() when needed.
Play On AwakeAs soon as the object is enabled, it prepares to create a trail. If it is not checked, call Play() when needed.
Public Methods
Emit()Emit trail at current position and rotation manually.
Emit(TrailProperties)Emit trail at current position and rotation manually with specific properties.
Emit(TrailPropertyAsset)Emit trail at current position and rotation manually with specific property asset.
Emit(Vector2, Quaternion, TrailProperties)Emit trail at specific position and rotation with properties.
RemoveAll()Remove all emitted trails.
Play()Activate SpriteTrail script.
Stop()Deactivate SpriteTrail script.

Export and Import Properties

You can save the properties externally by selecting the “Export Properties” button on SpriteTrail. By assigning this stored property asset to SpriteTrail’s “Property Asset” field. As a result, you can use the same properties for multiple trails with a single property asset.