One shot effect in Particle System
Asked Answered
S

5

0

How do I mimic a one shot effect from the old Particle emitter in the new Shuriken Particle System?
Trying to convert a particle effect to the new system.

Shofar answered 2/9, 2023 at 19:2 Comment(0)
P
0

You should check the Emission pane in the Inspector. There you will see Bursts, which can be used to achieve what you want. There’s no autodestruct available anymore, so you need to destroy the particle through code. There’s a value IsAlive in ParticleSystem that can be used to check if you can destroy the particle.

Greets

Paz answered 6/6, 2023 at 1:38 Comment(1)

For those who are using it, check the "Rate" field, set it to 0 if you don't want any particle flying around between the 'explosions'.

Gravimetric
H
0

Hi,

Im new to unity and im trying to create a pong game where the ball will create sparks when it hits a wall. I’ve developed it so this happens but im not sure how to remove the particles through code. Would you be able to give me an example?

Hitandrun answered 31/10, 2012 at 10:21 Comment(1)

You can attach this to the particle prefab you instatiate. var timer : float; function Start() { AutoDestruct(); } function AutoDestruct() { yield WaitForSeconds(timer); Destroy(gameObject); }

Shofar
S
0

You can attach this to the particle prefab you instatiate.

var timer		: float;
  
function Start() 
{
    AutoDestruct();
}

function AutoDestruct()
{
    yield WaitForSeconds(timer);
    Destroy(gameObject);
}
Shofar answered 2/9, 2023 at 19:2 Comment(0)
C
0

If you uncheck looping, then it will make the particle system run its duration and then stop. Then all you have to do is Destroy the gameobject (as said above :wink: after the duration is done. The WaitforSeconds would be the duration!

Creaky answered 6/6, 2023 at 1:46 Comment(0)
L
0

Well I’m sure that creating a temporary emitter that destroys itself after a time is possible and works, it sounds very very much inefficient to do for every single source of sparks when all you wanted was to emit an instantaneous number of sparks that will die out naturally due to the particle system settings. I am willing to bet you can just add particles directly to a system but I’ll have to look into it actually myself.

Linskey answered 2/9, 2023 at 17:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.