Unassegned Reference Exception on Finish Line particle system

Hi everyone! :slight_smile:
I’m trying to make the finish line particles work but when I reach the line with Berry the game crushes due to this error:

error

As you can see from the next image, the Particle System is linked to the serialized field

serializeField

Here’s the FinishLine script:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.SceneManagement;

public class FinishLine : MonoBehaviour

{

[SerializeField] float reloadDelay = 1f;

[SerializeField] ParticleSystem finishEffect;

 void OnTriggerEnter2D (Collider2D other){

    if(other.tag == "Player"){

        finishEffect.Play();

        Invoke("ReloadScene", reloadDelay);

    }

}

void ReloadScene(){

SceneManager.LoadScene(0);

}

}

Thanks for the help!

All of this looks good. Check your scene and make sure there isn’t another object with a FinishLine script on it

Feel so dumb, I linked the script on both the finish line object and the child with the sprite.
Thanks for the answer! :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms