Description
Describe the bug
A Signal Emitter from the timeline to Stop any UIParticles using the ParticleSystem.Stop() method will not work. Only a Signal using UIParticle.Stop() will work (but note that this will also stop any other particle systems nested under that UIParticle object, if there are any). I believe this is probably a bug.
Sample Scene, Timeline, Signal and Particle: Assets.zip
To Reproduce
Steps to reproduce the behavior:
0. Create a new Unity Project and add the UIParticle package via the git link and the TextMeshPro package
- Create a new Game Object "Director" and add a PlayableDirector component to it
- Create a new TimelineAsset for that object and assign it to the Playable field
- Create a new UI Canvas
- Create a new GameObject "UI Particle" under the Canvas and add the UIParticle component to it
- Create a new GameObject "Particles" under the UIParticle object and add a ParticleSystem component to it
- Disable the Particles object
- Click on the Director object and open the timeline editor to edit the timeline asset
- In the Timeline editor add a new Control Track and drag the Particles object on it (or just drag the object on the timeline)
- Create a new Signal track and drag the Particles object as the Signal Receiver object on the left side
- Right click in the middle of the control track (should be around 300 frames so middle would be frame 150) and choose "Add Signal Emitter"
- Create a new Signal Asset called "Stop Particles" and when prompted add Signal Receiver components to the Particles object
- Click on the Signal Emitter on the timeline and add a new Signal Reaction in the Signal Receiver segment in the inspector window on the right
- Choose "Editor And Runtime" and "ParticleSystem > Stop()" method
- Create a new Button under the UI Canvas and add an OnClick event to it that calls the "PlayableDirector > Play()" method of the Director object
- Save the scene
- If you now play the game and click the button to trigger the timeline, you will notice that the particle system doesn't stop emitting in the middle of the timeline duration but instead keeps playing until the end and then just disappears when the Particles object is reverted to its disabled state.
- If you then stop the game, go to the Signal Emitter on the timeline and add a new reaction that targets the "UI Particle" object and calls "UIParticle > Stop()" method, save and play again, you will notice that the particle system stops emitting in the middle of the timeline.
Expected behavior
Since the "Usage" section of the UIParticle readme states that particles can be controlled using either methods (ParticleSystem > Stop() and UIParticle > Stop()) I believe this is probably a bug. Took me quite a while to realize why my ParticleSystems were not stopping 😅
Screenshots
Sample Scene, Timeline, Signal and Particle: Assets.zip
Environment (please complete the following information):
- Version: 4.10.2
- Platform: Target Platform: Windows; Architecture: Intel 64-bit
- Unity version: 2022.3.45f1]
- Build options: Scripting Backend: Mono; API Compatibility Level: .NET Standard 2.1