Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Collapsible / Expandable panels of more information onClick

Discussion in 'Scripting' started by FreshCoder-731319, Jun 10, 2020.

  1. FreshCoder-731319

    FreshCoder-731319

    Joined:
    May 21, 2020
    Posts:
    17
    I have been trying to figure out If it is possible to have collapsible panels within unity.
    For example, what i have is multiple panels (3x6) containing items sort of like a menu list.What I am trying to achieve is if a user clicks on one of the items another panel of information will collapse shifting the below items further down making room for a full line panel of information. Then after clicking again the panel of more information will shift back up!

    I have been taking a look at EditorGUILayout.Foldout along with Accordions..Could someone give me a hand please? Screenshot 2020-06-10 at 10.27.58.png
     
  2. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,063
    If you have a data class that holds the information you can add a boolean for the Foldout. Then use this in the for loop that you're rendering the grid list items. For every 3 items you render, you check if one of those items Foldout = true, if so.. render that foldout panel.
    Something like that?

    Since you're working with Unity Editor UI, maybe give UI Elements (renamed to UI Toolkit) a try. Add the UI Builder package from the Package manager. Working with a flexbox UI might be a lot easier to work with than in code Editor UI IMGUI.
     
  3. FreshCoder-731319

    FreshCoder-731319

    Joined:
    May 21, 2020
    Posts:
    17
    Thanks for the reply! Once i test it out i will give you an update
     
  4. Sayoj

    Sayoj

    Joined:
    Oct 22, 2020
    Posts:
    3
    Hey, I am trying to do the same... do you have any update on how you did it now?