title: the name does not exist in current context - but I've put my varaible in class
body: <p>code:</p>
  
  <pre><code>using UnityEngine;
  
  public class Runner : MonoBehaviour {
  
      public static float distanceTraveled;
      private static int boosts;
      public float acceleration;
      public Vector3 boostVelocity, jumpVelocity;
      public float gameOverY;
      public float highScore = 0f;
  
      private bool touchingPlatform;
      private Vector3 startPosition;
  
      void Start () {
          GameEventManager.GameStart += GameStart;
          GameEventManager.GameOver += GameOver;
          startPosition = transform.localPosition;
          renderer.enabled = false;
          rigidbody.isKinematic = true;
          enabled = false;
      }
  
      void Update () {
          if(Input.GetMouseButtonDown(0)){
              if(touchingPlatform){
                  rigidbody.AddForce(jumpVelocity, ForceMode.VelocityChange);
                  touchingPlatform = false;
              }
              else if(boosts &gt; 0){
                  rigidbody.AddForce(boostVelocity, ForceMode.VelocityChange);
                  boosts -= 1;
                  GUIManager.SetBoosts(boosts);
              }
          }
          distanceTraveled = transform.localPosition.x;
          GUIManager.SetDistance(distanceTraveled);
  
          if(transform.localPosition.y &lt; gameOverY){
              GameEventManager.TriggerGameOver();
          }
          // the bit i car about                     &lt;----------------------
          if(distanceTraveled &gt; highScore) {
              highScore = distanceTraveled;
          }
  
      }
  
      void FixedUpdate () {
          if(touchingPlatform){
              rigidbody.AddForce(acceleration, 0f, 0f, ForceMode.Acceleration);
          }
      }
  
      void OnCollisionEnter () {
          touchingPlatform = true;
      }
  
      void OnCollisionExit () {
          touchingPlatform = false;
      }
  
      private void GameStart () {
          boosts = 0;
          GUIManager.SetBoosts(boosts);
          distanceTraveled = 0f;
          GUIManager.SetDistance(distanceTraveled);
          transform.localPosition = startPosition;
          renderer.enabled = true;
          rigidbody.isKinematic = false;
          enabled = true;
      }
  
      private void GameOver () {
          renderer.enabled = false;
          rigidbody.isKinematic = true;
          enabled = false;
      }
  
      public static void AddBoost(){
          boosts += 1;
          GUIManager.SetBoosts(boosts);
      }
  }
  </code></pre>
  
  <p>i get a 'variable distance does not exist in the current context, but I defined the variable in the class, so its there. What happens to it?</p>