title: Why does my variable reset to 0 in my Unity C# script
body: <p>I have a simple project with a button in a scene that, when tapped, starts the StartWorking function in this script:</p>
  
  <pre><code>using UnityEngine;
  using UnityEngine.UI;
  using System.Collections;
  
  public class DoWork : MonoBehaviour {
  
    public int Cash = 5;
  
    public void StartWorking() {
          Debug.Log (Cash);
          Debug.Log ("Ran!");
          Cash++;
          Debug.Log (Cash);
    }
  }
  </code></pre>
  
  <p>When ran and on tapping the button the console says:</p>
  
  <p>0<br>
    Ran!<br>
    1</p>
  
  <p>instead of expected:</p>
  
  <p>5<br>
    Ran!<br>
    6</p>
  
  <p>Any idea why the variable is not keeping it's set initial value in the class?</p>
  
  <p>Thanks.</p>