Unity Unite 2024: A Pivotal Moment for Unity’s Future The recent Unite 2024 event in…
Adding Trails to Unity – Gameobjects & Characters
In this article we would like to introduce our asset Trails FX. This asset is ideal for games with moving objects or characters which you want to show off their movement speed or movement effect on a specific animation or action.
It uses GPU instancing and use correct transparency order, creating mesmerizing, long and performant trails. Trails FX comes with many options which allows you to create a great variety of effects from simple color trail to rainbow texture stamps and space distortion effects.
When you import the asset, a new folder called Trails FX will be created inside your project structure, which contains a Demo scene to quickly see the main features, a Documentation folder with helpful information about the main settings and configuration of the asset, and other folders with necessary resources of the asset.
Adding Trails FX is very easy: you just have to select the object or character which you would like the effect to be applied to, and add the script Trail Effect as new component in the inspector panel. Keep in mind that this effect requires a mesh renderer to work properly. For example, in the image above of the King Arthur animation, the main prefab has its skinned mesh renderer as child of the main model.
What I did is to add the TrailsFX script to this main model, but instead select the child with the mesh renderer property:
Now it’s time to go through the different options in the inspector panel. To start with you can select or create a new profile, ideal to save time in the next project.
The second step, as we pointed before is to select the mesh renderer that will have the effect applied. After finishing doing these steps, you can go through the two categories that will give life to the effect.
The Trigger options determine how the trail effect will behave and what will take in consideration to activate. In the Appearance section you can select effect type, and you will be able to choose between several options like color, texture, clone, space distortion and dash. Finally, you can define properties like duration of the effect, position and scale.
If you have a skinned mesh render with several animations, you can choose whether the trail effect will be always enabled or be activated with an animation in particular in the “Skinned Mesh” tab. This step will make the game gain in optimization by disabling the effect in unnecessary animations.
If you like this effect, we invite you to follow our official YouTube channel to keep in touch with further videos and tutorials about Trails FX and our other assets.