- Home /
Input.mousePosition updating?
I am having a very odd issue. I tracked it down to trying a very simple:
using UnityEngine; using System.Collections;
public class Mouse_SceneClick : MonoBehaviour {
// Use this for initialization void Start () {
}
// Update is called once per frame void Update () {
if (Input.GetMouseButtonDown(0))
{
Debug.Log("Clicked at " + Input.mousePosition);
}
}
}
No matter how or where I move the mouse in the window the position always comes out exactly the same
Clicked at (196.0, 242.0, 0.0) UnityEngine.Debug:Log(Object) Mouse_SceneClick:Update() (at Assets\Scripts_HHT\Interface\Mouse_SceneClick.cs:16)
It detects the mouse and the script or it would not be detecting clicking, but beyond that I cannot get any usable information. I am using Unity 2.5 (I understand the patch dealt with a related issue but that was for Mac, I am on a PC - Dell XPS if it makes a difference). I can't upgrade to 2.6 until tomorrow since we have an investor lined up and this is the last feature I am trying to squeeze in - I don't want to risk breaking my system right before tomorrow if I don't have to.
So... anyone have a similar issue by chance that they found a resolution to? Am I missing something incredibly silly and obvious?
-Daniel
Answer by Daniel Cazan · Dec 01, 2009 at 10:43 AM
Arg, never mind. I have no idea what was wrong and I have been head-butting this for hours now trying to find the line of code I must be doing wrong. Fortunately the year I did tech support finally kicked in so I slapped my forehead, restarted my computer, and now Unity detects the mouse positions correctly. Its always the brute force method that prevails isn't it? Sorry about that.