- Home /
 
Unity 4.6 ui slider wont slide
I am using Unity 4.6.4p2. The problem I have now is that the new UI slider wont slid with mouse. It only slides when the keyboard left or right arrow keys are pressed. It selects/higlight when I click on it but the mouse cannot slider it. My project is huge and I don't know why it is NOT sliding. I have tried deleting and creating new slider but that didn't work either.
I created a new empty project with a new slider and the slider works. The new empty project slider worked with mouse but the one in my project isn't working. The project is almost complete and is in GUI phase and I can't start everything over again just because of a slider problem.
Any suggestions?
It's really hard to help with this little info, share something more, describe your hierarchy and how are your components setup.
For the GUI hierarchy, I have a gameobject called GUI. Inside the the GUI gameobject, I have canvas then a slider under the canvas. I really don't think that the hierarchy is the problem because I have moved or created new sliders outside of the parent game object I named GUI but that problem is still there.
Answer by hangemhigh · Apr 14, 2015 at 11:27 PM
The problem is because I put the canvas of the slider in a an empty gameobject. If I remove the gameobject and use the canvas as the parent object, it works. So basically the parent object of the slider should be canvas or else it wont work. This should be fixed.
I tryed but it did not work the first time so i kept googling and find another cause of the problem. I was having the both so that's why i will respondo, so if anyone in the future have the same problem and read this can solve it.
Basicaly the canvas have to be the father of the slider and apart of making sure that nothing is blocking the slider, Also, we have to make sure that the canvas is set to Screen Space - Camera, other wise it dont work. I'm not sure why but after trying a whole morning the only way it work for me is with this set up.
Answer by jacksonkmillsaps · Sep 19, 2015 at 03:30 AM
I had a slider-not-sliding problem. It turned out that the slider was overlapped by a UI.Text that was its sibling. Even though the actual text was not overlapping the slider, the box that contained the text was. Moving the text solved the problem.
Answer by MedzsikBoj · Sep 04, 2015 at 02:46 PM
I know this is an older thread, but I had the same issue and found something interesting
What you said is correct, if the parent of the slider is not Canvas it won't work.
But let me actually correct you on one thing, that is it won't work only if the Slider Direction is set to Left To Right. If you set it to Right to Left it will work correctly even if the parent is not a Canvas.
Also, if the Z position of the Slider is not the same as the canvas it wont work, in my case, i have the slider as child of a Panel, but the panel was not on the same Z position as the canvas, the slider didn't slide on any of the Slider Directions, so I just added it directly to the canvas, and tried it out and it worked, so i took that same Slider i added first to the canvas and made it child of the panel, and it worked just fine.
At the end to test my theory, i took the first slider that added directly into the panel, and took the Z position of the one i added first to the canvas, and the slider worked just fine.
Just in case some one else may have this same issue.
I just ran into this problem, but it turned out @jacksonkmillsaps is right. There was a Text item overlapping the slider. In your case the slider probably worked switching Right to Left, because the overlapping item isn't on the right side (it is exactly what happened for me). So anyone running into this issue, first check that there isn't some other object potentially in front of and blocking input. Once I moved the offending text object out of the way, my slider is working and it is not directly a child of a Canvas.
Answer by JoeStrout · Jun 28, 2017 at 10:00 PM
I ran into this today (in Unity 5.6.2!) and spent quite a bit of time tracking it down. For posterity, in my case the problem was that the camera's near clipping plane was 100, and our Screen Space - Camera canvas's plane distance was also 100. This apparently put the UI right at the edge of the clipping plane, where it mostly worked... except for slider dragging.
Changing the canvas's plane distance to 101 (or any value larger than the main camera's near clipping plane) fixed it.
Thanks for this. This was my exact issue and I seriously thought I was going crazy, haha
Answer by jamaster96 · Jan 28, 2016 at 01:29 PM
None of the above worked for me. The slider responds to clicking but not sliding, even if it is on its own in the canvas. The problem was to do with the connection between the event system and canvas.
If the canvas is a child of another gameobject, the Rect Transform changes and the slider cannot be dragged. However when the canvas has no parent, it drives the rect transform values on it's own and recognises slider dragging.
I haven't found a work-around to this apart from having every canvas parent-less.
Your answer