C# - Access the Same Variable in Two Scripts

I have int score = 0; in a script named Done_GameController.cs. Then, I have code that changes the value of score:

public void AddScore (int newScoreValue)
	score += newScoreValue;
	UpdateScore ();

void UpdateScore ()
	scoreText.text = "Score: " + score * 10;

void SecondScore ()
	score + 10;

Then, I have a script named Done_DestroyByContact.cs which basically controls the player’s death. Here’s the code:

if (other.tag == "Player")
   Instantiate(playerExplosion, other.transform.position, other.transform.rotation);

I’m not sure what to put where the ????? is, but I want it to be something like this:

score - 200;

In other words, I want to change score to score - 200. How can I do this?

hey @Nathansmash You could either define score as a static variable
static int score = 0; (makes it a global variable, kinda scary)

or create Accessors - getter/setter (which is better)

public int Score{
        get {return score;}
        set {score = value;}

this will let you ‘set’ and ‘get’ the value of score from other scripts.