How to modify the material of individual particles?

I made a dissolve shader in shader graph and wrote this script to make it dissolve over time.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Dust : MonoBehaviour
{
    public ParticleSystemRenderer system;
    public float dissolveSpeed;

    private void Update()
    {
        system.material.SetFloat("_DissolveStrength", system.material.GetFloat("_DissolveStrength") + Time.deltaTime * dissolveSpeed);
    }
}

This works for a particle system that only needs to appear once, but if I want something that continuously emits it doesn’t work because after it dissolves, all the other particles start out fully dissolved. Is there a workaround to this?

If you want a _DissolveStrength for each particle, look at ParticleSystem.SetCustomData.

There is an example here that sets custom data, and sends it to a custom shader:

When dissolving is enabled, in the update, you’ll want to add some value to each particle’s dissolve value in the custom data. eg

if (dissolving)
{
    for(int i = 0; i < particles.Length; i++)
    {
        customData[i].x += dissolveSpeed * deltaTime;
    }
}