Hello, I am trying to make a click to move script that finds the mouse position and moves the player to it. However, it gives this error:
Assets/NewBehaviourScript.js(13,62): BCE0077: It is not possible to invoke an expression of type 'UnityEngine.Vector3'.
And my code is:
#pragma strict
var cam = Camera.main;
var clickPosition = Vector3.zero;
function Start () {
}
function Update () {
if(Input.GetKeyDown(KeyCode.Mouse0))
{
clickPosition = cam.ScreenToWorldPoint(Input.mousePosition());
clickPosition.z = 0;
Debug.Log (clickPosition);
}
}
Thanks in advance.