Search Issue Tracker
By Design
Votes
1
Found in
2018.4
2019.2
2019.2.6f1
2019.3
2020.1
Issue ID
1191639
Regression
No
Trail Renderer does not stop emitting when TrailRenderer.emitting is set to false
How to reproduce:
1. Open the user-submitted project
2. Enter Play mode and wait for the animation to finish
Expected result: Trail Renderer stops emitting on the position where the Animation finished
Actual result: Trail Renderer stops emitting when the Cube is moved to the start position
Reproducible with: 2018.4.12f1, 2019.2.10f1, 2019.3.0b7, 2020.1.0a9
Notes:
TrailRenderer.emitting was not introduced in Unity 2017.4, therefore the issue was not reproducible.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note:
When emitting is set to false, the width will taper towards zero at the next added point.
I appreciate this doesn't give you the effect you want, but changing it risks breaking things for other users.
Luckily there is a simple trick to get the behaviour you want. Just add an extra position when you set emitting to false, to force the trail to instantly reduce to zero width:
void Update()
{
if (!_animation.isPlaying)
{
_trailRenderer.emitting = false;
_trailRenderer.AddPosition(_trailRenderer.transform.position); // NEW CODE
transform.position = Vector3.zero;
enabled = false;
}
}
Hope it helps!