Hello!
I’m designing a game on which I want to have a particle system that can have the velocity of the particles change with time, however, even though I’ve found a similar question and the answer made sense, when I tried to do the same in my project it did not work, the existing particles didn’t seem affected by the change in their velocity. How can I change it at runtime? This is the reference I used:
void Update()
{
if (m_Particles == null || m_Particles.Length < particleSystem.main.maxParticles)
m_Particles = new ParticleSystem.Particle[particleSystem.main.maxParticles];
// GetParticles is allocation free because we reuse the m_Particles buffer between updates
int numParticlesAlive = particleSystem.GetParticles(m_Particles);
// Change only the particles that are alive
for (int i = 0; i < numParticlesAlive; i++)
{
m_Particles_.velocity += Vector3.forward * 5;_
} // Apply the particle changes to the Particle System particleSystem.SetParticles(m_Particles, numParticlesAlive); }