I am looking to uniformly distribute a persistent set of particles across a lattice of Vector3 points.
I have instantiated and constructed the grid using a method similar to this one:
for (int x = 0; x < Volume; x++)
{
for (int y = 0; y < Volume; y++)
{
for (int z = 0; z < Volume; z++)
{
GridPoints.Add(new Vector3(...));
}
}
}
I can instantiate game objects across each of the points using a foreach method (for example I used some spheres to display the grid for debugging and testing purposes). However, what I would really like to do would be to implement a ParticleSystem gameobject procedurally, with static single particles persisting on each point of the grid (1:1 ratio of points to particles). I would like to be able to utilise the functionality and efficiency of the ParticleSystem dynamics for rendering out the grid visually, both for performance and aesthetics.
However, after thoroughly combing through the Unity documentation and reading some posts, I cannot seem to instantiate the ParticleSystem within a gameobject procedurally in C#. Could someone walk me through an example based on the above snippet? I’m no coding expert and still getting used to procedural object generation in Unity so a little hand-holding would be much appreciated. Many thanks.