Search Unity

Sliders can't be moved to the left of the middle of the game window with Screen Space - Overlay

Discussion in 'UGUI & TextMesh Pro' started by jp2222, Jan 28, 2015.

  1. jp2222

    jp2222

    Joined:
    Apr 6, 2013
    Posts:
    17
    Hopefully the title says it all.

    I've a few sliders, which I can grab / move, but movement is only updated if the mouse cursor is to the right of the middle of my game window.

    Mouse / Slider code is updating (the slider handle turns a different colour when I click on it), but I can't physically move the slider to the left, past the middle of my game screen. I can initialise the slider handle position to a low value (eg. 0), so it's not being limited due to the slider value..

    Through trial and error, I change my canvas Render Mode to Screen Space - Camera, and it works....

    Is this a known bug with Screen Space Overlay? Am I missing something to get it working in this mode?

    Thanks!
     
  2. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    Do you have an example project showing the issue?
    Not seen anything myself showing the behaviour, not even in the UI Examples asset on the store provided by UT.
     
  3. jp2222

    jp2222

    Joined:
    Apr 6, 2013
    Posts:
    17
    Sorry -no example project at the moment.

    A little more messing around, and things get weirder..

    It seems that there's still a problem in Screen Space - Camera too.

    This one is how the handle reacts to user input..

    To explain: I can grab a slider handle only if it's to the right of a certain part of the screen width. Even when I've grabbed the handle, when I move it around, it changes colour, between Pressed (which I'd expect, as it's being pressed and moved!) and Normal (which I wouldn't expect, as it's still actually being dragged around!). Again, it only changes colour to "Normal" when it goes further left than this magical x position...!

    This also means that currently, I can't grab the handle if it's placed too far left of the screen.


    There's obviously some weirdness going on here. The fact that I'm dragging a slider, but it's reporting that it's in Normal mode makes me think it's somehow not me... For Unity to report that the handle is in normal mode, even though I'm still dragging it (my cursor is still on top of the handle)....weird...

    I've tried swapping my UI camera from Perspective to Orthographic..Same thing happens..

    UPDATE:

    So, I change the slider to vertical (Direction=Bottom To Top)

    It's now pretty much placed in the middle of the screen..However, if the slider handle is moved to the top half of the screen, again, it changes colour to "Normal" mode and can't be grabbed again..


    Am I the only one who's having problems here?!
     
    Last edited: Jan 29, 2015
  4. jp2222

    jp2222

    Joined:
    Apr 6, 2013
    Posts:
    17
    Fixed!

    OK, just thought I'd post another update....


    So, along with my slider is some text to the left hand side of it (Music Volume / SFX Volume).
    The width of these UI Text objects were far wider than the text...And were bleeding through to the sliders positions.

    On checking out the EventSystem TTY, I saw that the "Pointer Enter" entry was showing the Text game object when I moved the slider towards closer to the text..

    So, simple solution after all... I just had to resize my text Rect Transform width....

    Hopefully if someone else ever falls into this trap, this might help!

    Just wondering - Is there a way to see visually the size of a text UI game object? Drawing a box around all of the UI components, for example?
     
    soozical and MaratG2 like this.
  5. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    Easiest way to see the RectTransfor is to either use the RectTool (which shows the Rect Transform Border) or temporarily add a panel as a child, which has a default grey image and defaults to the full size of it's parent. Just remove it when you have finished looking :D