title: Unity - Error CS106: Type 'Score' does not contain a definition for scoreUp
body: <p>For the past couple of days I've been trying to make a simple flappy bird game. At the moment, I'm trying to write some code that will make the score go up every time the player passes through two pipes. I'm getting an error though, and I'm not too sure how to fix it. This is my code:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class Score : MonoBehaviour {
  
      public static int score = 0;
  
      private void Start() {
          score = 0;
      }
  
      private void Update() {
          GetComponent&lt;UnityEngine.UI.Text&gt;().text = score.ToString();
      }
  
      public void scoreUp() {
          score++;
      }
  }
  </code></pre>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.SceneManagement;
  
  public class AddScore : MonoBehaviour {
  
      public Score score;
      
      private void OnTriggerEnter2D (Collider2D collision) {
          score.scoreUp(); // the line thats giving me problems
      }
  
  }
  </code></pre>
  <p>The error I'm getting is: error CS1061: Type <em>Score</em> does not contain a definition for <em>scoreUp</em> and no extension method <em>scoreUp</em> of type <em>Score</em> could be found.</p>
  <p>This doesn't make sense to me. Unity says 'The CS1061 error is caused when you try to call a method or access a class member that does not exist.'. But as can be seen in the code above, I DO have a class called Score and I DO have a method inside it called scoreUp().</p>
  <p>Furthermore, I have used this kind of code before (where I created a class, used it and its method inside another class) without any problem. So I'm really not sure what the problem is in this specific scenario.</p>