How would I suspend the mouse look script? I want to be able to click on my GUI in first person with out turning my head/(camera) to select a GUI.button. Can't I add a command to the mouse look script to suspend it when I hold down shift or alt?
You check the current mouse position against the window containing your GUI element(s) and set a global (I use a Plugin, you could also use a common script object). Then in MouseLook, return early from Update if that's set. Also, clear that global boolean in a LateUpdate function.
I made this my 'global' variable manager:
using UnityEngine;
public class GUIManager : MonoBehaviour
{
public static bool GUI_is_showing = false;
public static void SetGUIShowing (bool val)
{
GUI_is_showing = val;
}
public static bool isGUIshowing()
{
return GUI_is_showing;
}
void LateUpdate()
{
GUIManager.GUI_is_showing = false;
}
}
Then in my OnGUI() functions:
windowRect = GUILayout.Window (1, windowRect, EditView, "My View");
var mouseOverMe : boolean = windowRect.Contains(Event.current.mousePosition);
if (mouseOverMe)
GUIManager.SetGUIShowing (true);
Then in MouseLook:
void Update ()
{
if (GUIManager.isGUIshowing())
return;
Sorry I didn't see this in my original search, but this thread actually covers what I was talking about, How do I disable mouse look when a button is pressed? Maybe my mis-phrasing will help some other hillbilly find his answer too...