Problem using point.Length in a particle system c#

All I want to do is generate a length of discrete points along a line using a particle system. The rest of my code is fine, with the exception of this part, which is supposed to actually generate the particles.
code:

void Update() {
     particleSystem.SetParticles(points, points.Length);
}

When I hover over the “.Length” part, it says it’s an unresolved member. Unity also gives me 203 of this error message: “Object reference not set to an instance of an object,” and each sends me to the line of code in Update.
What am I doing wrong? How do I fix this?

From my experience, you actually have to get the particles before you can set them. Not every frame, but at least once you need to get some existing particles before you change them and reassign them.

using UnityEngine;
using System.Collections;
 
public class NewBehaviourScript : MonoBehaviour {
 
    public int resolution = 10;
 
    private ParticleSystem.Particle[] points;
 
    void Start () {
		if (resolution < 10 || resolution > 100) {
		  Debug.LogWarning("Grapher resolution out of bounds, resetting to minimum.", this);
		  resolution = 10;
		}
		points = new ParticleSystem.Particle[resolution];
		particleSystem.Emit(resolution);
		StartCoroutine( SetupParticles() );
		
    }
    IEnumerator SetupParticles () {
        yield return null;
    	particleSystem.GetParticles( points );
    	float increment = 1f / (resolution - 1);
    	for (int i = 0; i < resolution; i++) {
    		float x = i * increment;
    		points*.position = new Vector3(x, 0f, 0f);*

_ points*.color = new Color(x, 0f, 0f);_
_ points.size = 0.1f;
}
particleSystem.SetParticles(points, resolution);
}
}*
I’d try something like that. I emitted resolution particles, got them, then modified them before reassigning them to the original. You can’t access particles immediately after they are created. That’s why I yielded a frame before accessing them._

Oh my goodness. Apparently my code was written as:

void start() {
codecodecode…}

and not

void Start() {
codecodecode…}

so it didn’t recognize the start method, and didn’t run it upon startup.

My code works fine now. I have no idea how I missed that.