Hello, so I’ve went ahead and noticed that my crush delay does not work as intended, it does not actually delays. My finish line works just fine but it seems like my crush is not, I serialized it and it does not change at all, there is no delay, thank you.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class CrashDetector : MonoBehaviour
{
[SerializeField] ParticleSystem crashEffect;
[SerializeField] AudioClip wilhelmScream;
[SerializeField] float crushDelay = 0.5f;
void OnTriggerEnter2D(Collider2D other)
{
if(other.tag == "Ground")
{
crashEffect.Play();
GetComponent<AudioSource>().PlayOneShot(wilhelmScream);
Invoke("ReloadScene", crushDelay);
SceneManager.LoadScene(0);
}
}
void ReloadScene()
{
SceneManager.LoadScene(0);
}
}