Search Unity

Unity UI Limit UI navigation scope

Discussion in 'UGUI & TextMesh Pro' started by geranim0, Feb 16, 2018.

  1. geranim0

    geranim0

    Joined:
    Jan 5, 2018
    Posts:
    2
    Hi, I got multiple canvases : game, overlay, ui, popups...

    I have a problem: I want to add controller support. But the automatic navigation option scope includes all my canvases, so when I use the controller to try to change the selected gameobject, I can select totally unrelevant gameObjects from other canvases.

    I want to be able to limit the automatic navigation to a specified depth. If this is not possible, will I be obligated to implement all the UI transitions by hand?

    I'm already aware of the solution consisting of using canvas group and making the root canvas group set inactive and set current UI window active at each transition, but this is not what I'm looking for since I want background UI elements to have their original look and color remain even if a popup pops up, and this is not possible with canvas group solution because background UI gets grayed out.
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    You could try the navigation mode "Explicit" ?
     
  3. geranim0

    geranim0

    Joined:
    Jan 5, 2018
    Posts:
    2
    I could
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    I agree; use Explicit. You may also want to monitor the currently-selected object. If there isn't one, or if it's on the wrong set of selectables, it's possible that the player bumped the mouse and changed the selection. In this case, reselect a valid selectable.
     
  5. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    met same problem. mode [explicit]'s problem is, how about dynamically generated UI objects? how explicit set them before even instantiated? At its prefab? Then how to explicit them each other? There is none because now in editor and not the game play mode now, so don't know now how much of them will be generated.
     
    DMorock likes this.
  6. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    Are there no sample codes about this manipulation?