+3

get particles of particlesystem and store it to a particle array

MS80 3 years ago updated by 3d_Artist 2 years ago 10

The "GetParticles" unit does not store single particles to a regular list or array, it has to be a "ParticleArray"! Right now (Bolt 1.3) I found no regular way to create such a particle array, but I found a workaround to convert a array list with a prefilled amount of objects to a particle array:

  1. make sure you have added "UnityEngine.ParticleSystemModule" to assemblies and "Particles of Particle System" to units (Unit Option Wizard)
  2. create empty array list
  3. add items (can be empty) to the array list with the amount of particles you want to store (important)
  4. convert it to "ParticleArray" with "ArrayList to Array" unit and set Type to "Particle of ParticleSystem"
  5. use "Get Particles" in update flow to get and use particles data f.e to set position for instances

Here is a simple example which shows how to use the "GetParticles" unit and the "ParticleArray" to set the position of instantiated gameobjects:

There may be more optimized ways out there to create and fill a particle array, so please let me know ;)

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Hi,

Its very helpful if u shared package.


+1

Sure, check the attached package. Just drag the prefab into a empty scene and have a look at the graph on the particle system ;)

ParticleArrayScenePrefab.unitypackage

Hey,

How to do this in bolt.

m_Particles = newParticle[m_System.main.maxParticles];

Sorry for very beginner level question.

You should get the "Main Module" of Particle System, then you can use "Get Max Particles" or "Expose Main Module of Particle System" to get the maximum particle count.

Thank you so much.

particle.asset

Hello,

I want to set every particle velocity but it is not happen.

Hello!

You do not write the change back into an array of particles.

As an example.


thanks for the reply.