Skip to content

Commit

Permalink
fix: fix cached position for pre-warmed particles
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Feb 24, 2021
1 parent b93e0e4 commit e3f42d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion Scripts/UIParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ protected override void OnEnable()
#if !SERIALIZE_FIELD_MASKABLE
maskable = m_Maskable;
#endif
_cachedPosition = transform.position;
activeMeshIndices.Clear();

UIParticleUpdater.Register(this);
Expand Down
3 changes: 3 additions & 0 deletions Scripts/UIParticleUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ private static void BakeMesh(UIParticle particle)

particle.cachedPosition = position;

if (particle.activeMeshIndices.CountFast() == 0)
diff = Vector3.zero;

for (var i = 0; i < particle.particles.Count; i++)
{
Profiler.BeginSample("[UIParticle] Bake Mesh > Push index");
Expand Down

0 comments on commit e3f42d7

Please sign in to comment.