- Home /
Disabling mouse wheel when user is scrolling ScrollView
Hello everyone,
Basically, I have two scripts so that one (ScrollView.cs) is responsible for ScrollView and other(CameraControl.cs) is for zooming by using mouse wheel.
Zooming codes are in LateUpdate. Scrolling codes are in OnGUI.
I think, the problem is obvious, I do not want to zooming in-out when user is scrolling the ScrollView.
I tried the changing order of script execution. But nevermind, I do not know why but it did not work.
Thanks in advance.
Answer by PAEvenson · Sep 10, 2012 at 03:56 PM
It doesn't matter which script is executing first. Both are running independently of each other. If I had the following code `if(Input.GetMouseDown(0) == true)` in two different scripts, both will execute the if statements. listzto had the right idea. I would check if the Input.mousePosition is over GUI view then disable/enable the cameraControl script.
Answer by liszto · Sep 10, 2012 at 02:21 PM
Maybe just disabled the CameraControl.cs when your mouse cursor is on your GUI where you do your scrolling ?
Answer by btasdoven · Sep 10, 2012 at 07:13 PM
Here is my code. I tried disabling CameraControl script. Unfortunately, It does not work:
oldScrollPos = scrollPosition;
scrollPosition = GUI.BeginScrollView (new Rect (1460,650,340,255),scrollPosition, new Rect (0, 0, 0, notList.Count*65-5));
if (oldScrollPos != scrollPosition)
GameObject.Find("Camera").GetComponent<CameraControl>().enabled = false;
else
GameObject.Find("Camera").GetComponent<CameraControl>().enabled = true;
Your answer
Follow this Question
Related Questions
GUIlayout scrollbar, Not working well... 1 Answer
How to disable ScrollView dragging 4 Answers
How to set position in ScrollView? 1 Answer
How can I set the mousewheel scroll speed in a ScrollView? 3 Answers
Character Zoom in and out 1 Answer