Search Unity

UI Slider Jump to Click

Discussion in 'UGUI & TextMesh Pro' started by crdmrn, Sep 15, 2017.

  1. crdmrn

    crdmrn

    Joined:
    Dec 24, 2013
    Posts:
    152
    Simple question, is there a way to have the built-in UI Slider jump to the mouse position when clicking anywhere on the slider, or does it only work with drag? :S
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Afaik, you can click the slider's area with the mouse and it goes there? That is the default behaviour, in my experience.
     
  3. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    @methos5k is correct, the default behaviour of both the Slider and Scrollbar is "Click to jump" using mouse. Should be the same with touch (unless you hold the control which initiates a drag)
     
  4. Lumpazy

    Lumpazy

    Joined:
    Apr 24, 2018
    Posts:
    45
    It looks like it is the default, but unfortunately it shows sometimes erratic behaviours :/
    I looked up this question because mine didn't jump to click either.

    So i just created a new slider instead of the dysfunctional one. it worked fine. as stated here.

    adjusting some size etc values it didn't anymore.
    so i deleted it and started over, and as i happened to click on my original slider... it suddely worked .... without having changed almost anything to it ! i.e. except its position !

    so there. somewhere in all this must be the reason for this question to be asked at all .....

    i guess that it may be because of some overlapping layers or some masking going on etc
     
  5. Lumpazy

    Lumpazy

    Joined:
    Apr 24, 2018
    Posts:
    45
    Same for me, but then simple answer :
    The background image of the slider has to be raycast-able. Easy to overlook...