Hello all!
I am trying to use the GUI.BeginScrollView but since I have the MouseLook set on the camera, it rotates when I scroll in my GUI.BeginScrollView.
I thought I would just disable the MouseLook script but I do not know when I can call it. There should be an Event or something that I am overlooking that lets me know I am clicking on the ScrollBar.
Any thoughts?
Thanks!
[EDIT]
I’m thinking of using GUI.GetNameOfFocusedControl…
Not sure if this will help, but there are enable/disable script commands in this thread:
http://forum.unity3d.com/viewtopic.php?t=58619&highlight=turn+off
Thanks but I know how to disable scripts. I just need to know when I have clicked on the Vertical Scrollbar so I can call to disable the mouselook.
Ok, the GUI.SetNextControlName doesn’t seem to work with Scrollview. Can anyone see the flaw in this?
using UnityEngine;
using System.Collections;
public class ScrollviewTest : MonoBehaviour {
private Vector2 scrollViewVector = new Vector2();
void OnGUI()
{
if (GUI.GetNameOfFocusedControl() == "testingScrollView")
{
Debug.Log("GUI.GetNameOfFocusedControl (): " + GUI.GetNameOfFocusedControl());
}
GUI.SetNextControlName("testingScrollView");
scrollViewVector = GUI.BeginScrollView(new Rect(0, 0, 350, 150), scrollViewVector, new Rect(0, 0, 325, 1000));
if (GUI.Button(new Rect(0, 0, 325, 100), "I am a button"))
{
Debug.Log("I Clicked the magical candy like button!");
}
GUI.EndScrollView();
}
}