Search Unity

Question Send data to ParticleSystemVertexStream.Center to change particle positions

Discussion in 'Scripting' started by afhorne, May 8, 2021.

  1. afhorne

    afhorne

    Joined:
    May 3, 2021
    Posts:
    5
    I found a lot of tutorials about how to send new custom data to a Particle System's vertex streams, but how do I send data to any of the "built-in" vertex streams, like ParticleSystemVertexStream.Center, in order to manually change the position of each particle?

    Thanks for your help!
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    In the Renderer module, enable Custom Vertex Streams, then add the Center stream to the list. Now it is available to your custom shader at the TEXCOORD specified by the UI.

    (That system is for sending data to shaders. If you just want to set particle positions from script, look at ParticleSystem.GetParticles and SetParticles, or there is a job system method too where you set the positions in a C# job.)
     
    afhorne likes this.