Instantiating a Particle System in c# code.

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.

You don’t instantiate a particle system. You use GameObject.AddComponent() to add it to a game object. Here is a script that creates 100 of them

function Start () {
  for (var i = 0; i < 100; i++) {
  	var go : GameObject = new GameObject("test");
  	go.AddComponent(ParticleSystem);
  	go.transform.position = Random.insideUnitSphere * 8.0;
  
  }

You also make a prefab of a game object with a particle system, and Instantiate() prefabs at your position.

You mention “efficiency” of particle systems, and having a system with only one particle. I doubt it will be very efficient (over just have a game object). But maybe you can use a single particle system and palace the particles at your positions. Use ParticleSystem.GetParticles and ParticleSystem.SetParticles to get the array of particles. Then you can set the individual characteristics of each particle such as velocity, position and lifetime.

Note if you need a really efficient method for a very large number of “particles,” you could build your own mesh.