title: C# error: An object reference is required for the non-static field, method, or property
body: <p>I want my player to give a speed boost for a few seconds. When it collects 4 items (paintCount = 4), the player gets a movement speed boost for a short period of time.
  I always have an error in the class Paintser: <code>SimplePlayer0.SpeedUp();</code>.
  I've tried many things to counter it, but none of them are working.
  I'm working in Unity.</p>
  
  <p>Error: An object reference is required for the non-static field, method, or property 'SimplePlayer0.SpeedUp().</p>
  
  <p>This is the players script:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class SimplePlayer0 : MonoBehaviour
  {
  
    // SPEEDVARIABLES
    public static float speed = 3.5f;
  
  
    // BONUSSPEED
    private static float speedBoostTime;
    public static float SpeedBoostTime
    {
      get
      {
        return speedBoostTime;
      }
      set
      {
        speedBoostTime = value;
      }
    }
  
  
  
     // BONUSSPEED
     public void SpeedUp()
    {
      speed *= 2;
      SpeedBoostTime = 3; // seconds
    }
  
     void Update()
     {
      // BONUSSPEED
      while (speedBoostTime &gt; 0)
      {
       speedBoostTime -= Time.deltaTime;
       if (speedBoostTime &lt;= 0) speed /= 2;
      }
    } 
  </code></pre>
  
  <p>This is the power up script, where the gameobject gets destroyed.</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class PowerUp : MonoBehaviour
  {
    void OnTriggerEnter2D(Collider2D other)
    {
      if (other.tag == "Player")
      {
        Paintser.ExtraTime();
        Destroy(this.gameObject);
        Paintser.paintCount++;
      }
    }
  }
  </code></pre>
  
  <p>And finally the script where all the magic  (or errors) happens:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class Paintser : PowerUp
  {
  
    public static int paintCount = 0;
    public int speedBoostTime = 3;
  
    public static void ExtraTime()
    {
      if (paintCount == 4)
      {
  
        SimplePlayer0.SpeedUp();
  
        Paintser.paintCount = Paintser.paintCount = 0;
  
      }
    }
  }
  </code></pre>