title: error CS0120: An object reference is required to access non-static member `UnityEngine.Camera.ScreenPointToRay(UnityEngine.Vector3)'
body: <p>I'm really not sure whats wrong...</p>
  
  <p>im following along to a YouTube Video because this code is much too advanced for me. I dont know if its a problem with unity 5 or whatever but it just keeps giving me this error:  error CS0120: An object reference is required to access non-static member `UnityEngine.Camera.ScreenPointToRay(UnityEngine.Vector3)'</p>
  
  <p>I know its probably a bad idea to copy from YouTube without knowing what it means but im just trying to get a script for touchscreen stuff.</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using System.Collections.Generic;
  
  public class TouchInput : MonoBehaviour {
  
  public LayerMask touchInputMask;
  
  private List&lt;GameObject&gt; touchList = new List&lt;GameObject&gt;();
  private GameObject[] touchesOld;
  
  private RaycastHit hit;
  
  void Update () {
  
      #if UNITY_EDITOR
      if (Input.GetMouseButton(0) || Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0)) {
  
          touchesOld = new GameObject[touchList.Count];
          touchList.CopyTo(touchesOld);
          touchList.Clear();
  
          Ray ray = Camera.ScreenPointToRay(Input.mousePosition);
  
          if(Physics.Raycast(ray,out hit,touchInputMask)){
  
              GameObject recipient = hit.transform.gameObject;
              touchList.Add(recipient);
  
              if(Input.GetMouseButtonDown(0)){
                  recipient.SendMessage("OnTouchDown",hit.point,SendMessageOptions.DontRequireReceiver);
              }
              if(Input.GetMouseButtonUp(0)){
                  recipient.SendMessage("OnTouchUp",hit.point,SendMessageOptions.DontRequireReceiver);
              }
              if(Input.GetMouseButton(0)){
                  recipient.SendMessage("OnTouchStay",hit.point,SendMessageOptions.DontRequireReceiver);
              }
          }
  
          foreach (GameObject g in touchesOld){
              if(!touchList.Contains(g)){
                  g.SendMessage("OnTouchExit",hit.point,SendMessageOptions.DontRequireReceiver);
              }
          }
      }
      #endif
  
      if (Input.touchCount &gt; 0) {
  
          touchesOld = new GameObject[touchList.Count];
          touchList.CopyTo(touchesOld);
          touchList.Clear();
  
          foreach (Touch touch in Input.touches) {
  
              Ray ray = Camera.ScreenPointToRay(touch.position);
  
              if(Physics.Raycast(ray,out hit,touchInputMask)){
  
                  GameObject recipient = hit.transform.gameObject;
                  touchList.Add(recipient);
  
                  if(touch.phase == TouchPhase.Began){
                      recipient.SendMessage("OnTouchDown",hit.point,SendMessageOptions.DontRequireReceiver);
                  }
                  if(touch.phase == TouchPhase.Ended){
                      recipient.SendMessage("OnTouchUp",hit.point,SendMessageOptions.DontRequireReceiver);
                  }
                  if(touch.phase == TouchPhase.Stationary || touch.phase == TouchPhase.Moved){
                      recipient.SendMessage("OnTouchStay",hit.point,SendMessageOptions.DontRequireReceiver);
                  }
                  if(touch.phase == TouchPhase.Canceled){
                      recipient.SendMessage("OnTouchExit",hit.point,SendMessageOptions.DontRequireReceiver);
                  }
              }
  
          }
          foreach (GameObject g in touchesOld){
              if(!touchList.Contains(g)){
                  g.SendMessage("OnTouchExit",hit.point,SendMessageOptions.DontRequireReceiver);
              }
          }
      }
  
  }
  }
  </code></pre>