Skip to main content

About UIFX - Trail

Overview

What?

UIFX-Trail is a new visual effect for Unity's UI (uGUI) components that adds a trail that follows the motion of the component.

Screenshot

Why?

Unity's UI system currently doesn't have an option to render with a trail.

Trails can be beautiful and add an element of fun, so we created this component to be easy to use, yet have powerful options.

How?

Just add the UIFX-Trail component to your UI component. That's it!

The component will track the full motion of the object (translation, rotation and scale) either at a transform level, or at a per-vertex level. A new mesh is then generated based on the motion, and this is rendered in place of the original UI geometry. The effect is only applied when the object is in motion.

Features

  • Easy to use
  • Highly optimised
  • Cross-platform
  • Built-in/URP/HDRP
  • Supports TextMeshPro
  • Source code included
  • Well documented
  • Well supported
  • API documentation

Usage

Damping can be set to a high value to make the trail follow the original motion more closely.

Compatibility

Unity Version6.x2023.x2022.x2021.x2020.x2019.x2018.x2017.x
Supported
PlatformWindows/UWPmacOSLinuxAndroidiOS / tvOSWebGLPS4 / PS5XBox One
Supported
Render PipelineBuilt-inURPHDRP
Supported

Dependencies

This plugin requires the Unity.UI package that is included with Unity by default.

If you want to use it with TextMeshPro then it requires version 2.2.0-preview.3 or newer. In the package manager you may need to manually switch to one of the newer preview versions by using package name: com.unity.textmeshpro and version: 3.2.0-pre.6. For Unity 2022 or higher, you can use version: 4.0.0-pre.2.

The Asset Package

The asset package consists of the following files:

Screenshot

A demo scene is included. All scripts are grouped using Assembly Definition files.

Components

This Unity asset includes two components:

  • TrailEffect - Adds a visual trail to UI components
  • TrialEffectTMP - Same as TrailEffect but specifically for TextMeshPro

Supported Features

UI Feature        SupportedNotes
Components:
    Text
    Image
    RawImage
    Mask
    Rect Mask 2D
    CanvasGroup
    TextMeshPro
    Custom
Canvas Render Modes:
    Screen-Space Overlay
    Screen-Space Camera
    World Space
Render Pipelines:
    Built-in
    URP
    HDRP
Effects:
    ShadowUIFX-Trail renders with flickering if Shadow effect is applied first
    OutlineUIFX-Trail renders with flickering if Outline effect is applied first
Colorspaces:
    Gamma
    Linear

Advanced

Performance

UIFX-Trail has had several optimisation passes, so we can say with confidence that it is highly performant. That said, it does rebuild a new mesh each frame, so some consideration is still necessary.

Garbage Collection

This component has been optimised to reduce garbage generation.