How to add particle effects at the end of the game?


I try to add some particle effects when the player reaches a certain score, I created a routine for this but I don’t know where to call it because I would have to call it in the update but it can’t
Does anyone know how I can solve this problem?

Create the particle system in the editor, then create a public variable in the class that counts the score. Then drag the particle system to that variable in the inspector, and in the code you do Play when the score is reached.

public ParticleSystem effect; //<- drag particle system here in Inspector
bool effectStarted = false;
    if(score > valueToWin && !effectStarted)
        effectStarted = true;