The Trail Renderer component renders a trail of polygons behind a moving GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary, over time. This can be used to give an emphasized feeling of motion to a moving object, or to highlight the path or position of moving objects.
The Trail Renderer uses the same algorithm for trail renderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
See in Glossary as the Line RendererA component that takes an array of two or more points in 3D space and draws a straight line between each one. You can use a single Line Renderer component to draw anything from a simple straight line to a complex spiral. More info
See in Glossary.
To create a Trail Renderer:
By default, a Trail Renderer uses the built-in Material, Default-Line. You can make many changes to the appearance of the trail without changing this Material, such as editing the color gradient or width of the trail.
For other effects, such as applying a texture to the trail, you will need to use a different Material. If you do not want to write your own ShaderA small script that contains the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. More info
See in Glossary for the new Material, Unity’s built-in Standard Particle Shaders work well with Trail Renderers. If you apply a Texture to a Trail Renderer, the Texture should be of square dimensions (for example 256x256, or 512x512).
If you apply more than one Material to a Trail Renderer, the trail is rendered once for each Material.
See Creating and using Materials for more information.
The Min Vertex Distance value determines how far in world units the GameObject to which the trail applies must travel before a new segment is added to the trail. Low values like 0.1 create trail segments more often, creating smoother trails. Higher values like 1.5 create segments that are more jagged in appearance. Additionally, wide trails may exhibit visual artifacts when the vertices are very close together and the trail changes direction significantly over a short distance.
For performance reasons, it is best to use the largest possible value that achieves the effect you are trying to create.
|Cast Shadows||Determines whether the trail casts shadows, whether they should be cast from one or both sides of the trail, or whether the trail should only cast shadows and not otherwise be drawn. See Renderer.shadowCastingMode in the Scripting API reference documentation to learn more.|
|Receive Shadows||If enabled, the trail receives shadows.|
|Dynamic Occludee||When Dynamic Occludee is enabled, Unity culls this Renderer when it is blocked from a Camera’s view by a Static Occluder. Dynamic Occlusion is enabled by default.
When Dynamic Occludee is disabled, Unity does not cull this Renderer when it is blocked from a Camera’s view by a Static Occluder. Disable Dynamic Occlusion to achieve effects such as drawing the outline of a character behind a wall.
See documentation on occlusion cullingA Unity feature that disables rendering of objects when they are not currently seen by the camera because they are obscured (occluded) by other objects. More info
See in Glossary for more information.
|Motion Vectors||Select the Motion Vector type to use for this Trail Renderer. See Renderer.motionVectorGenerationMode in the Scripting API reference documentation to learn more.|
|MaterialsAn asset that defines how a surface should be rendered, by including references to the Textures it uses, tiling information, Color tints and more. The available options for a Material depend on which Shader the Material is using. More info
See in Glossary
|These properties describe an array of Materials used for rendering the trail. Particle Shaders work best for trails.|
|Lightmap Parameters||Reference a Lightmap Parameters AssetAny media or data that can be used in your game or Project. An asset may come from a file created outside of Unity, such as a 3D model, an audio file or an image. You can also create some asset types in Unity, such as an Animator Controller, an Audio Mixer or a Render Texture. More info
See in Glossary here to enable the trail to interact with the global illumination system.
|Time||Define the length of the trail, measured in seconds.|
|Min Vertex Distance||The minimum distance between anchor points of the trail (see Minimum vertex separation below).|
|AutoDestruct||Enable this to destroy the GameObject once it has been idle for Time seconds.|
|Width||Define a width value and a curve to control the width of your trail at various points between its start and end. The curve is applied from the beginning to the end of the trail, and sampled at each vertex. The overall width of the curve is controlled by the width value.|
|Color||Define a gradient to control the color of the trail along its length.|
|Corner Vertices||This property dictates how many extra vertices are used when drawing corners in a trail. Increase this value to make the trail corners appear rounder.|
|End Cap Vertices||This property dictates how many extra vertices are used to create end caps on the trail. Increase this value to make the trail caps appear rounder.|
|Alignment||Set to View to make the line face the CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary, or Transform Z to face the Z axis of its Transform componentA Transform component determines the Position, Rotation, and Scale of each object in the scene. Every GameObject has a Transform. More info
See in Glossary.
|Texture Mode||Control how the Texture is applied to the line.
Use Stretch to map the texture once along the entire length of the line.Use Tile to repeat the texture along the line, based on its length in world units. Use DistributePerSegment to map the texture once along the entire length of the line, assuming all vertices are evenly spaced. Use RepeatPerSegment to repeat the texture along the line, repeating at a rate of once per line segment.
|Generate Lighting Data||When enabled, the trail geometry includes Normals and Tangents. This allows the trail to use Materials that use the sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary lighting, for example via the Standard ShaderA built-in shader for rendering real-world objects such as stone, wood, glass, plastic and metal. Supports a wide range of shader types and combinations. More info
See in Glossary, or by using a custom shader.
|Shadow Bias||Move shadows along the direction of the light to remove shadowing artifacts cused by approximating a volume with billboarded geometry.|
|Sorting Layer||Name of the Renderer’s sorting layer.|
|Order in Layer||This Renderer’s order within a sorting layer.|
|Light ProbesLight probes store information about how light passes through space in your scene. A collection of light probes arranged within a given space can improve lighting on moving objects and static LOD scenery within that space. More info
See in Glossary
|Probe-based lighting interpolationThe estimation of values that determine the shape of an animation curve between two keys. More info
See in Glossary mode.
|Reflection ProbesA rendering component that captures a spherical view of its surroundings in all directions, rather like a camera. The captured image is then stored as a Cubemap that can be used by objects with reflective materials. More info
See in Glossary
|If enabled and reflection probes are present in the Scene, a reflection Texture is picked for this Trail Renderer and set as a built-in Shader uniform variable.|