Stop the camera from rotating when dragging a GUI.slider

Hi,

I’m using a camera lookat type of script to have a camera that rotate around a target and on the side of my screen I’ve got two large sliders (GUI.verticalSlider), I need to know when the user is currently dragging the slider.

I tried to use a detection on mouseOver mouseOut to block the camera (with a bool switch), but if the user start dragging the slider and move the mouse out of the GUI.slider while dragging the OnOff switch of the camera is switched back on.

Thanks for any help or advices

Use GUIUtility.hotControl to determine if a GUI is being used

C#:

if (GUIUtility.hotControl == 0)
{
// allow/rotate your camera
}

Awesome Thanks!!! I’ve been playing with guis and interface for few years and never found

Yea I’ve never heard of that one. Nice find! Usually I would just do a bunch of rect checks.

Usually I would just use a single bool to determine if I’m in “guimode” or not