Search Unity

Compiler error

Discussion in 'General Discussion' started by gdelotavo, Jun 18, 2019.

  1. gdelotavo

    gdelotavo

    Joined:
    May 29, 2019
    Posts:
    1
    Plss Help I'm Getting this error I'm using unity 2018.3.14f1
    Assets\PlayerController.cs(17,50): error CS0117: 'Input' does not contain a definition for 'MousePosition'

    Here's my Script:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class PlayerController : MonoBehaviour
    4. {
    5.     Camera cam;
    6.     // Use this for initialization
    7.     void Start()
    8.     {
    9.         cam = Camera.main;
    10.     }
    11.  
    12.     // Update is called once per frame
    13.     void Update()
    14.     {
    15.         if (Input.GetMouseButtonDown(0))
    16.         {
    17.             Ray ray = cam.ScreenPointToRay(Input.MousePosition);
    18.             RaycastHit hit;
    19.  
    20.             if (Physics.Raycast(ray, out hit))
    21.             {
    22.                 Debug.Log("We hit " + hit.collider.name + " " + hit.point);
    23.                 // Move our player to what we hit
    24.                 // Stop
    25.             }
    26.         }
    27.     }
    28. }
     
  2. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    673
    lowercase
    MousePosition -> mousePosition