- Home /
The question is answered, right answer was accepted
Emulate Editor's Particle Scrubbing Functionality in Game
Hi there, I am working on an app that pairs 3D video with Particles from Unity's Shuriken Particle System to create a sort of immersive experience. My 3D video player has scrubbing functionality, and I developed a system to tie the multiple particle systems I used to the same scrubber bar as the video, effectively syncing up the Particles and Video playback. When the video is scrubbed forward or back, I set the ParticleSystem.time
of each of my ParticleSystems to the Seek-ed timestamp value.
My issue is that, rather than moving the ParticleSystem simulation forward or backwards in time, it appears that the ParticleSystem just continues simulating from that point, leaving any particles that have already been created to do their own thing. I'd like to create a system that attempts to emulate Unity's in-editor Particle Scrubbing functionality, where the whole particle simulation is rewound to the way it looked at x timestamp, rather than just resimulating the particles. I tried ParticleSystem.Clear
, but then slowly emitting particles take awhile to spin back up again, and any particles that would remain from before the timestamp aren't present.
My question is this: Is there a way I can create Unity's Particle Simulation (Specfiically the Playback Time scrubber) in game without having to do calculus to manually position individual particles?
Thanks in advance!! This is my first post after being a longtime lurker, so I apologize for any etiquette or formatting mistakes I've made. Thanks again for any help!! Below is an example of intended functionality, and the following link shows how my functionality differs: https://imgur.com/k0HY4ZD alt text
Answer by connerpstern · Feb 25 at 04:03 PM
Okay, so for anyone who has the same question in the future, I immediately figured it out this morning. Rather than setting ParticlesSystem.time
one calls ParticleSystem.Simulate()
passing in a set time and setting restart to true so that t
is the time passed is in seconds from the start of the particle simulation (otherwise it is a time offset from the particlesystem's current time). Documentation link: https://docs.unity3d.com/ScriptReference/ParticleSystem.Simulate.html