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.
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.
- 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 - 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 - 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 - 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
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.
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.
- 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 - 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 - 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 - 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
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.
- 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 - 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 - 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 - 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
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.
3. Create the moving tip and Trail Renderer
- 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 - 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 - Start with one trail using the settings below.
Time controls trail duration; the script controls speed
| Setting | Value | Purpose / check |
|---|---|---|
| Trail / Time | 0.25 s | Retain a short movement history. |
| Trail / Min Vertex Distance | 0.02 | Minimum movement for another trail point. |
| Trail / Width | 0.08 | A narrow constant-width curve. |
| Trail / Alignment; Texture Mode | View; Stretch | Face the camera and stretch one texture over the trail. |
| Trail / Emitting; Autodestruct | On; Off | Generate during movement without destroying the object. |
| Trail / Color | White, Alpha 1 → 0 | Keep 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.
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.
5. Tune ribbon length separately from speed
- 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 - Restore Time 0.25 and compare angular speeds 90 and 180 separately.
Time controls trail duration; the script controls speed - 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
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
| Symptom | First check | Comparison |
|---|---|---|
| No ribbon | Moving object and component | Put both the trail and script on WindTip. |
| Solid donut | History, width and opacity | Shorten history first, then lower width/opacity. |
| Long line after movement | Old history | Set the reused position before clearing the history. |
Completion checks: compare under matching conditions
- Identify head/tail and verify the old tail fades.
Time controls trail duration; the script controls speed - Change history and speed independently and explain each effect.
Time controls trail duration; the script controls speed - Inspect from angled views for a readable narrow ribbon.
Time controls trail duration; the script controls speed - Disable/re-enable and check for stale connecting segments.
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.