mob-sakai / mob-sakai/ParticleEffectForUGUI

Switched from regular Particle Systems, now Play() resets the simulation and I have no way to determine whether it's already playing or not

Open
#355 2 comments 0 reactions 1 assignee View on GitHub

@mob-sakai is already working on this.

Since Feb 12, 2025.

question
Dominant language
C#
Stars
6k
Forks
762
PR merge metrics
No merged PRs in 30d

Description

Hi guys!

I'm using a particle system to highlight a card in my game. It has 3 distinct coloured highlight states or turned off entirely.

  • So if it has to be highlighted, I set the color and called Play().
  • If it doesn't have to be highlighted, I called Stop().

This way:

  • it slowly started and stopped,
  • while seamlessly "faded" between states/colours: e.g. when the highlight state changed from "Usable" to "Forbidden".
    • There was no issue with always calling Play() when changing the highlight state/colour, even if it was already in some other highlighted state -> thus playing.
    • Because Unity didn't care about the particle system already being played, it just ignored my unnecessary Play() request I guess.

But now I switched to this package, and here it seems that Play() resets the simulation.

  • So when I switch from blue highlight to green, all particles get erased and the system starts over slowly. So no more seamless transition.

I tried to fix this by only calling Play() if the particle system isn't playing. But after hours of trying I couldn't get it to work.

  • I could only find IsPaused but it's false in the beginning, when the system is stopped. So it really means just "being paused" and not "is not playing".
  • Checking isPlaying on the underlying particle system didn't work either, because I guess it's never really playing. It's just used as a template and for Simulation by the package's UIParticles, right?

How could I make my highlight system work once again? Should I fork the package and disable somehow the auto-reset in Play()? Or how could I detemine whether it's already playing or not?

Thanks in advance! :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.