The questions in the title, I made sure that I added this:
using UnityEngine.EventSystems;
right under:
using UnityEngine;
using System.Collections;
So I’m a bit dumbfounded, anyway this is my code:
public GameObject currentSelectedGameObject;
void Update () {
if (Input.GetMouseButtonDown (0)) {
if (!EventSystems.EventSystem.currentSelectedGameObject ()) {
Vector3 mousePosition = Input.mousePosition;
mousePosition.z = 10; // distance from the camera
target = Camera.main.ScreenToWorldPoint (mousePosition);
target.z = transform.position.z;
}
}
transform.position = Vector3.MoveTowards (transform.position, target, speed * Time.fixedDeltaTime);
}