Need Help Urgent with CS1061

Im having this weird Problem With the ScreenPointToRay:

/Users/Shared/Unity/071216 Mow Envi 01/Assets/PickupObject.cs(25,25): Error CS1061: Type UnityEngine.GameObject' does not contain a definition for ScreenPointToRay’ and no extension method ScreenPointToRay' of type UnityEngine.GameObject’ could be found. Are you missing an assembly reference? (CS1061) (Assembly-CSharp)

It seems like the componend does not exist?

Any suggestions?

using UnityEngine;
using System.Collections;


public class PickupObject : MonoBehaviour {
    GameObject mainCamera;
    bool carrying;
    GameObject carriedObject;
    public float distance;

    // Use this for initialization
    void Start () {
        mainCamera = GameObject.FindWithTag("MainCamera");
    }

    // Update is called once per frame


    void Update () {
        if(carrying) {
            carry(carriedObject);
        } else {
            pickup ();


        }

    }


    void carry(GameObject o)
    {

        o.GetComponent<Rigidbody>().isKinematic = true;
        o.transform.position = mainCamera.transform.position + mainCamera.transform.forward * distance;

    }

    void pickup ()
    {
        if(Input.GetKeyDown (KeyCode.E))
        {
            int x =  Screen.width / 2;
            int y = Screen.height / 2;


            Ray ray = mainCamera.ScreenPointToRay(new Vector3(200.200)); 
            RaycastHit hit;
            if(Physics.Raycast(ray,out hit)) {
                Pickupable p = hit.collider.GetComponent<Pickupable> ();
                if(p != null) {
                    carrying = true;
                    carriedObject = p.gameObject;


                }
            }
        }
    }



}

You need to get the Camera component off your mainCamera GameObject.
Alternatively Camera.main is a convenience property to grab the Camera tagged as MainCamera. Try changing the line:

Ray ray = mainCamera.ScreenPointToRay(new Vector3(200.200));

To:

Ray ray = Camera.main.ScreenPointToRay(new Vector3(200.200));

+Gizmoi thx ! I figured that out and improved a little:

Still I´m having issues picking up Objects. I just can´t take them…?!

using UnityEngine;
using System.Collections;

public class PickupObject : MonoBehaviour {

    GameObject mainCamera;
    bool carrying;
    GameObject carriedObject;
    public float distance;
    public float smooth;

    // Use this for initialization
    void Start () {
        mainCamera = GameObject.FindWithTag("MainCamera");
    }

    // Update is called once per frame
    void Update () {
        if (carrying) {
            carry (carriedObject);
            checkDrop();
        } else
            pickup ();
    }

    void carry(GameObject o)
    {
        o.GetComponent<Rigidbody>().isKinematic = true;
        o.transform.position = Vector3.Lerp (o.transform.position, mainCamera.transform.position + mainCamera.transform.forward * distance, Time.deltaTime * smooth);
    }
    void pickup()
    {
        if(Input.GetKeyDown(KeyCode.E))
        {
            int x = Screen.width /2;
            int y = Screen.height /2;
            Ray ray = mainCamera.GetComponent<Camera>().ScreenPointToRay(new Vector3(x,y));
            RaycastHit hit;
            if(Physics.Raycast(ray, out hit))
            {

                if(hit.collider.tag == "Physics_Prop")
                {
                    carrying = true;
                    carriedObject = hit.collider.gameObject;
                    hit.collider.gameObject.GetComponent<Rigidbody>().useGravity = false;

                }

            }

        }

    }

    void checkDrop()
    {
        if(Input.GetKeyDown(KeyCode.E))
        {
            dropObject();
        }

    }
    void dropObject()
    {
        carrying = false;
        carriedObject.gameObject.GetComponent<Rigidbody>().useGravity = true;
        carriedObject = null;
    }
}