Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Any help for a dropdown/hierarchy ?

Discussion in 'UGUI & TextMesh Pro' started by Mehd, Mar 14, 2017.

  1. Mehd

    Mehd

    Joined:
    Apr 29, 2016
    Posts:
    91
    Hi everyone,

    I am working on a project in which I have to supply informations for various agents in game. I want, just by passing the mouse over the location of the agent, to get a menu with the multiple fields I have to fill. The thing is, these fields are a the very last end of a hierarchy.

    Something of this taste :

    Example2.png

    I thought of a scrolldown menu, with children, but clearly, I don't know how. Does anyone have an idea ?

    Thanks !!


    PS: also, I'd like to have the possibility of increasing the number of fields.

    Thanks !
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,092
    I would do it like this:
    A scroll view in the "most root" hierachy. The content should have a (Vertical) Layout Group. Inside there you can have your other "roots" (let's call them "nodes").
    A node is a Toggle (it should expand / collapse the fields on click, right?). The child of the Toggle is one other Game Object with a (Vertical) Layout Group. The toggle sets that game object active / inactive.
    Inside the layout group you have your fields.

    If you use my Asset Better UI (see signature) you can use "Better Toggles" instead of Toggles. They already provide functionality to set game objects active / inactive when the trigger changes (on / off) without the need of writing one line of code.