Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Packages/src/Runtime/UIParticleRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ internal class UIParticleRenderer : MaskableGraphic
private int _index;
private bool _isPrevStored;
private bool _isTrail;
private bool _meshCleared;
private Bounds _lastBounds;
private Material _materialForRendering;
private Material _modifiedMaterial;
Expand Down Expand Up @@ -285,10 +286,14 @@ public void UpdateMesh(Camera bakeCamera)
|| (_isTrail && !_particleSystem.trails.enabled) // Trail, but it is not enabled.
)
{
// Skip clearing the mesh if it's already cleared.
if (_meshCleared) return;

Profiler.BeginSample("[UIParticleRenderer] Clear Mesh");
workerMesh.Clear();
canvasRenderer.SetMesh(workerMesh);
_lastBounds = new Bounds();
_meshCleared = true;
Profiler.EndSample();

return;
Expand All @@ -312,6 +317,7 @@ public void UpdateMesh(Camera bakeCamera)
// customData.SetVector(ParticleSystemCustomData.Custom2, 3, 0);
// }

_meshCleared = false;
var main = _particleSystem.main;
var scale = GetWorldScale();
var psPos = _particleSystem.transform.position;
Expand Down