How do I reset all static variables at the end of the game?

I have a big problem. I cannot find a way to reset all static variables in a class after the player reaches the end of the game. How do I do this? Here is my code so far.

GameStatus.cs:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class GameStatus : MonoBehaviour
{
    public int lives;
    public int score;

    public AudioSource source;

    public AudioClip bell;

    public static int target = 100;

    public PlayerController ball;

    public HealthManager hm;

    public GameObject gameOverScreen;

    public GameObject currentCheckpoint;

    public CountdownTimer ct;

    // Start is called before the first frame update
    void Start()
    {
        source = GetComponent<AudioSource>();
        gameOverScreen.SetActive(false);
        ball = FindObjectOfType<PlayerController>();
        hm = FindObjectOfType<HealthManager>();
        ct = FindObjectOfType<CountdownTimer>();
    }

    // Update is called once per frame
    void Update()
    {
        if (lives <= 0)
        {
            gameOverScreen.SetActive(true);
            ball.gameObject.SetActive(false);
        }
    }

    public void AddScore(int s)
    {
        score += s;
        while (score >= target)
        {
            AddLives(1);
            target += 100;
        }
    }

    public void ScoreMultiply()
    {
        int multiScore = 10;
        score += multiScore;
        while (score >= target)
        {
            AddLives(1);
            target += 100;
        }
    }

    public void AddLives(int l)
    {
        lives += l;
        source.PlayOneShot(bell);
    }

    public void LoseLives()
    {
        lives--;
    }

    void OnDestroy()
    {
        Debug.Log("'GameStatus' was destroyed");
    }

    public void Reboot()
    {
        score = 0;
        lives = 9;
        gameOverScreen.SetActive(false);
        ball.gameObject.SetActive(true);
        ct.ResetTime();
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
}

and GameManager.cs:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;

public class GameManager : MonoBehaviour
{
    public static GameManager instance;
    public static GameManager doOver;

    public bool isPaused;

    public Text scoreText, livesText;

    public int score = 0;

    public int lives = 9;

    void Awake()
    {
        if(instance == null)
        {
            instance = this;
        }
        else
        {
            if(instance != this)
            {
                Destroy(gameObject);
            }
        }
        DontDestroyOnLoad(gameObject);
    }

    void Start()
    {
        score = 0;
        lives = 9;
    }

    void Update()
    {
        scoreText.text = score.ToString();
        livesText.text = lives.ToString();
    }
}

Can someone, anyone please help solve this problem and give me an example to the solution? Thank you very much.

burchland2

Just another reason why you shouldnt be using static variables.Aside from the obligatory, you are doing it wrong and static members/ singletons are almost always an anti pattern comment.


Just set its value with the default value/ a new instance of what ever type it is.