This is the Unity version. See the matching Unreal Engine Niagara tutorial.

Back to the elemental comparison and recipes

What you will build

Move an invisible tip named WindTip around a circle and leave a short ribbon behind it. Trail Renderer draws the path an object has just traveled. A short C# script moves WindTip so the ribbon suggests circulating wind. The tip must move: attaching Trail Renderer to a stationary object does not create a long trail.

WindTip moves around the circle while Trail Renderer retains the previous 0.25 seconds of its path. Tip speed and trail duration are separate controls.
WindTip moves around the circle while Trail Renderer retains the previous 0.25 seconds of its path. Tip speed and trail duration are separate controls.

Preparation: make a small test scene

Use Unity 2022.3 LTS with URP 14 and save a separate practice Scene. A Scene is the workspace containing the floor, camera and effect. Hierarchy lists its objects; Inspector shows settings for the selected object. If you use another Unity version, including Unity 6, menu names and positions may differ.

  1. Right-click an empty area in Hierarchy, choose Create Empty and name it EF_Wind. In Inspector, open the Transform menu and choose Reset to restore its position, rotation and scale. The examples treat one Unity unit as one meter and keep parent scale at (1,1,1).
    Keep the practice scene and its assets together
    Keep the practice scene and its assets together
  2. Place a unit cube at (2,0.5,0) as a size reference, away from the effect origin. Add a floor cube at (0,-0.05,0), scale (4,0.1,4), with its top at Y=0.
    Scale reference
    Scale reference
  3. Frame the origin from an elevated angle in Scene view. Select Main Camera and use GameObject → Align With View, then verify the floor/work area in Game view.
    Match Main Camera to the Scene view
    Match Main Camera to the Scene view
  4. Inspect the Game view in Play mode against mid-gray, initially without bloom or strong grading. Keep a Directional Light for Lit materials, whose shading responds to lights. Bloom is the glow around bright areas; leave it off while checking shapes.
    Enter Play and inspect shape and motion in Game view
    Enter Play and inspect shape and motion in Game view

Build WindTip, its Trail Renderer, then the orbit script. Check each part on its own before adding the next part.

Object relationships

EF_Wind groups the whole effect. In the list below, each indented object is a child of the object above it. Start with the root and add the children in the order explained below.

EF_Wind
  WindTip (Trail Renderer + TutorialWindOrbit)

Check width and color inputs first

Width controls line thickness. Open its Curve and keep the start and end keys at the same height for an even line. Color and Alpha are separate: Alpha 0 is invisible and Alpha 1 applies no transparency reduction.

A script is a C# file that tells an object how to behave. Save the .cs file inside Assets using the exact filename shown below. Check Console for red errors, then drag the script onto the specified object. Keep it outside folders named Editor.

Move the tip around a circle and leave a thin strip behind it.
Move the tip around a circle and leave a thin strip behind it.

1. Prepare a grayscale mask

Mask_WindBand is a mask: white marks the visible shape, black marks hidden areas and gray creates partial transparency. Read R, the red component of this grayscale image, into the material’s opacity. The material adds color later. Finish the material setup below so the black area becomes transparent.

  1. In Photoshop create a 512×512 RGB, 8-bit image with a black background and a separate layer for the white shape.
    RGB / 8 bit
    RGB / 8 bit
  2. Paint a horizontal white band across the image, about 160 pixels tall at its center, and soften its upper/lower edges.
    Fill the width; keep black margins above and below
    Fill the width; keep black margins above and below
  3. Leave black margins above/below. Begin with uninterrupted horizontal coverage; use the Renderer color to control fading along the trail.
    Connect image brightness to opacity: black disappears
    Connect image brightness to opacity: black disappears
  4. Export Mask_WindBand.png and drag it into Unity Project. Start with Default type, sRGB off, Bilinear filtering and Clamp wrapping; select the imported PNG, click Apply in Inspector, and check that the preview contains the white shape and black margin.
    Connect image brightness to opacity: black disappears
    Connect image brightness to opacity: black disappears

512 is the image size used for this exercise. Keep the editable PSD. Compare a smaller resolution at the effect’s actual screen size before choosing the final size. Check PNG file size separately from memory used by the imported Unity texture.

2. Build the mask-and-color material

A Material holds appearance settings such as the image, color and transparency. Shader Graph builds the calculations by connecting nodes. Here the grayscale image supplies the shape and Tint supplies the color. Unlit displays that color without directional-light shading.

  1. Right-click in Project and choose Create → Shader Graph → URP → Unlit Shader Graph. Name it SG_WindBand and double-click to open it. Set Transparent surface, Alpha blending and Alpha Clipping off.
    RGB / 8 bit
    RGB / 8 bit
  2. In the Blackboard, use + to add Texture2D MaskTex, Color Tint and Float Intensity and Opacity. Enable Exposed for each so it appears in the Material Inspector. MaskTex chooses the image, Tint chooses its color, Intensity multiplies brightness and Opacity multiplies transparency. Set the default Tint to white with alpha one and both floats to one; verify them on the material too.
    Fill the width; keep black margins above and below
    Fill the width; keep black margins above and below
  3. Right-click empty graph space to add nodes, the small calculation blocks. Connect MaskTex to the Texture input of Sample Texture 2D. Use Multiply nodes to multiply sample R, Vertex Color A and Opacity, then pass the result through Saturate into Fragment Alpha. Multiply performs multiplication; Saturate limits the result to 0–1. Feed Tint RGB × Vertex Color RGB × Intensity into Base Color.
    Connect image brightness to opacity: black disappears
    Connect image brightness to opacity: black disappears
  4. Create M_WindBand from the saved graph, assign its PNG to MaskTex and set Tint to pale gray-green. Save the Material here. Assign it to the WindTip Trail Renderer after creating that object in the later steps. Renderer is the component that draws the object on screen.
    Connect image brightness to opacity: black disappears
    Connect image brightness to opacity: black disappears

Vertex Color passes the particle or line color and Alpha into the material. Multiplying its A makes settings such as Color over Lifetime visibly fade the result. For Particle System, open Renderer and check that Custom Vertex Streams includes Color and supplies the expected UV coordinates, which choose where the image is sampled.

See the Shader Graph walkthrough and mask workflow for node and export details.

Alpha-blend a band with soft top/bottom edges and include trail color.
Alpha-blend a band with soft top/bottom edges and include trail color.

3. Create the moving tip and Trail Renderer

  1. Place EF_Wind at Y=0.7, create an empty WindTip child, add Trail Renderer and assign M_WindBand.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed
  2. Move WindTip itself. A trail on a stationary parent will not extend merely because an unrelated child moves.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed
  3. Start with one trail using the settings below.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed
SettingValuePurpose / check
Trail / Time0.25 sRetain a short movement history.
Trail / Min Vertex Distance0.02Minimum movement for another trail point.
Trail / Width0.08A narrow constant-width curve.
Trail / Alignment; Texture ModeView; StretchFace the camera and stretch one texture over the trail.
Trail / Emitting; AutodestructOn; OffGenerate during movement without destroying the object.
Trail / ColorWhite, Alpha 1 → 0Keep RGB white and fade through alpha.

Select WindTip and open Trail Renderer Color. Temporarily give the two ends different colors to identify the moving tip and older tail. Keep the tip’s Alpha high and reduce the tail to Alpha 0. Once the tail fades correctly, return RGB to white.

Place the movement script and Trail Renderer on WindTip.
Place the movement script and Trail Renderer on WindTip.

4. Move the tip around a circle

Create TutorialWindOrbit.cs with the code below and attach it to WindTip after compilation. Set Radius 0.6 and Degrees Per Second 180. This script owns localPosition; do not animate the same position elsewhere.

You can also download TutorialWindOrbit.cs. It matches the listing. Keep the .cs extension and place it under Unity Assets.

using UnityEngine;

[RequireComponent(typeof(TrailRenderer))]
public sealed class TutorialWindOrbit : MonoBehaviour
{
    [SerializeField, Min(0f)] private float radius = 0.6f;
    [SerializeField] private float degreesPerSecond = 180f;
    private float angle;
    private TrailRenderer trail;

    private void OnEnable()
    {
        trail = GetComponent<TrailRenderer>();
        angle = 0f;
        PlaceTip();
        trail.Clear();
    }

    private void Update()
    {
        angle = Mathf.Repeat(angle + degreesPerSecond * Time.deltaTime, 360f);
        PlaceTip();
    }

    private void PlaceTip()
    {
        float radians = angle * Mathf.Deg2Rad;
        transform.localPosition = new Vector3(
            Mathf.Cos(radians) * radius, 0f, Mathf.Sin(radians) * radius);
    }

    private void OnDisable()
    {
        if (trail != null) trail.Clear();
    }
}

At 180 degrees per second a revolution takes two seconds. A 0.25-second history spans roughly 45 degrees: begin with a moving arc rather than a complete closed ring.

The 45-degree arc assumes constant speed and parent scale one, retaining 0.25 seconds of travel. Min Vertex Distance controls how far the tip moves before another point is added to the line. Smaller distances add more detail; Time controls how many seconds the trail remains.

A radius-0.6 tip moves at 180 degrees/s with 0.25 seconds of history. Choose history duration with Time before tuning point density.
A radius-0.6 tip moves at 180 degrees/s with 0.25 seconds of history. Choose history duration with Time before tuning point density.
Time controls trail duration; the script controls speed
Time controls trail duration; the script controls speed

5. Tune ribbon length separately from speed

  1. Compare Time 0.1 and 0.4 at the same angular speed. Reduce Time if the trail becomes an unwanted ring.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed
  2. Restore Time 0.25 and compare angular speeds 90 and 180 separately.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed
  3. After the first ribbon works, tilt the root or add one at a different height. Keep a clear primary ribbon instead of making every layer equally strong.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed

The script uses deltaTime and stops at timeScale zero. Treat pause-independent UI separately; clear stale trail history when teleporting/reusing the effect.

Estimate trail length separately from resolution

180 degrees/s × 0.25 s gives a 45-degree arc, about one eighth of a revolution. Minimum vertex distance controls sampling, while history, radius and speed determine extent.

Trail width is also in world units. Compare at parent scale one and inspect camera distance; low frame rates and teleports can still produce coarse paths.

From the first playback to saving

Check that the tip completes a turn in about two seconds with a short trailing band. If a whole ring remains, check Trail Time is 0.25 before changing speed.

After roughly 0.25 s in Play a short ribbon should follow the orbit. If WindTip stays still, inspect script attachment and Console before the material. Restart and look for stale connecting segments.

Inspector values tested in Play may reset when you stop. Write down the values you want to keep, exit Play and enter them again, then save the Scene. Drag the completed root object into Project to save a Prefab, a reusable file containing the whole effect.

Troubleshoot one cause at a time

SymptomFirst checkComparison
No ribbonMoving object and componentPut both the trail and script on WindTip.
Solid donutHistory, width and opacityShorten history first, then lower width/opacity.
Long line after movementOld historySet the reused position before clearing the history.

Completion checks: compare under matching conditions

  1. Identify head/tail and verify the old tail fades.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed
  2. Change history and speed independently and explain each effect.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed
  3. Inspect from angled views for a readable narrow ribbon.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed
  4. Disable/re-enable and check for stale connecting segments.
    Time controls trail duration; the script controls speed
    Time controls trail duration; the script controls speed

Continue by comparing another element

Return to the eight-element comparison to compare shape, motion and persistence. Another exercise is the earth / rock recipe.

References