Score counter total for all scenes.

I condensed my code so you don’t have to read 1000 lines of code.
Basically when I click, +1 gets added to the counter below.

var shotsFired = 0;
}

function OnGUI() {

GUI.Label(Rect(100, 100, 140, 20), shotsFired.ToString());

GUI.Label(Rect(100,70, 140, 20),“Shots Fired:”);

}

The counter works, every time I click, +1 gets added to the counter. Now the problem that I’m having is the total be continued on when switching to a new scene. Best way to do this? Thank you!

Purpose: Total score at the end of XYZ amount of levels in a game.

You can use a static class with shared objects.

using UnityEngine;

public class My : MonoBehaviour 
{
    public static bool IsPaused = false;
    public static GameObject LightForClinkerBlink=null;
}

And you can access to members from anywhere:

if(My.IsPaused)
...

And remember: in static class all members have to be static and initialized!