Search Unity

Set a button from another canvas on top of everything

Discussion in 'UGUI & TextMesh Pro' started by el_trex, Aug 11, 2017.

  1. el_trex

    el_trex

    Joined:
    Apr 13, 2016
    Posts:
    22
    RESOLVED (see this post)
    Hi I have a question :
    Before I had only 1 Canvas (the one create automatically when adding my first UI panel).
    As the last in hierarchy i had a button (quit button). So whatever UI objects I add, my exit button was always on top and interactable.
    Especially I have a slide panel that come over my game if i choose to deploy it.

    So before My exit button was on top and interactable even when the slide panel was deployed.

    That was OK.

    But now i need to separate the button from the main canvas as i Want everything else to be scalable when change of screen size. So only the Button will remain the same size no matter what.

    So the solution is to create a new canvas, extract the exit button from the main scallable with screen size Canvas, put in in the new non scalable Canvas and don't change the default Canvas Scaller component of the new Canvas to make it non scalable.

    This is OK except now when I deploy my slide panel, the exit button is underneath and non interactable !

    I tried to rearrange the order of the 2 canvas but either way i have the issue.

    Do you have any solution ?

    Attached is a screen capture of my Hierarchy of canvas. ExitButtonNotOnTop.png

    And here a video Showing the issue :



    Thanks.
     
    Last edited: Aug 12, 2017
  2. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    I'm guessing you have panels stretching out across the entire canvas. If you change the overlapping canvas' panel to be less wide and move it left you should be able to click the button on the canvas behind.
     
  3. el_trex

    el_trex

    Joined:
    Apr 13, 2016
    Posts:
    22
    Thx for your answer, but I think it is avoiding the issue not resolving it. Ofc if the panel dont slide over the button when deployed, i can interact with the exit button.
    But it is not resolving the issue, since i will and want have my panel deployed all over the screen and so, for now, over the button.
     
    Last edited: Aug 12, 2017
  4. el_trex

    el_trex

    Joined:
    Apr 13, 2016
    Posts:
    22
    Ok found the solution it was quite obvious : In your Canvas you have a Sort Order property. The higher the value is the more on top the canvas will be drawn.
    So I put 0 in Sort Order property of my canvas_scale (where my slide panel belongs to) and I put 1 in Sort Order property of my canvas_dont_scale (where my exit button belongs to).