c# - Unity2D ParticleSystem: Change the particle width and height with different values -



c# - Unity2D ParticleSystem: Change the particle width and height with different values -

how can create each particles stretch horizontally time goes on? seems unity 2d particlesystem have 1 float value size instead of separate float width , height.

i don't see options in inspector animate width , height of particlesystem separately.

here progress far. copied initial code unity doc site here , edited bit can alter size of each particle.

using unityengine; using system.collections; public class sampleparticle : monobehaviour { particlesystem m_system; particlesystem.particle[] m_particles; private void lateupdate() { initializeifneeded(); int numparticlesalive = m_system.getparticles(m_particles); // alter particles live (int = 0; < numparticlesalive; i++) { //============================================================ // here, can alter 1 value size of each particle //------------------------------------------------------------ m_particles[i].size = 100.0f * m_particles[i].lifetime; //============================================================ // aim code: //------------------------------------------------------------ //float lifetime = m_particles[i].lifetime; //m_particles[i].size.width = 100.0f * lifetime; //m_particles[i].size.height = 5.0f * lifetime; } // apply particle changes particle scheme m_system.setparticles(m_particles, numparticlesalive); } void initializeifneeded() { if (m_system == null) m_system = getcomponent<particlesystem>(); } }

c# unity3d particle-system

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -