TrailRenderer
TrailRenderer is a Unity component that creates visually appealing trails behind moving objects, like the tail of a comet streaking through the sky. These trails can enhance the realism of fast-paced games or add visual flair to various effects. Dive into the Unity's TrailRenderer Documentation to explore its capabilities in more detail.
Properties
Retrieves or sets the duration in seconds that the trail takes to fade away completely.
Determines the starting width of the trail at its base.
Specifies the ending width of the trail at its tip.
Scales the width of the trail uniformly.
Enables or disables automatic destruction of the trail renderer when it finishes emitting particles.
Indicates whether the trail renderer is currently emitting particles.
Sets the number of vertices to use for each corner of the trail.
Specifies the number of vertices for each cap of the trail.
Defines the minimum distance between consecutive vertices in the trail.
Determines the color of the trail at its start.
Specifies the color of the trail at its end.
Provides the number of positions in the trail's vertex array.
Sets the tiling of the trail's texture along its length.
Adjusts the distance of the shadow cast by the trail from the visible geometry.
Enables or disables the generation of lighting data for the trail.
Defines a curve that modifies the width of the trail along its length.
Methods
Updates the position of a specific vertex in the trail.
Parameters
index
The index of the vertex to update.
position
Vector3The new position for the vertex.
Returns
This method does not return a value.
Retrieves the position of a vertex in the trail.
Parameters
index
The index of the vertex to retrieve.
Returns
The position of the specified vertex.
Clears all positions and resets the trail to its initial state.
Returns
This method does not return a value.
Generates a mesh based on the current trail configuration.
Parameters
mesh
MeshThe mesh to bake the trail into.
useTransform
Flag indicating whether to transform the mesh into world space.
Returns
This method does not return a value.
Adds a new position to the trail, creating a continuous line.
Parameters
position
Vector3The new position to add.
Returns
This method does not return a value.