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

Different streched size GUI selection grid

Discussion in 'UGUI & TextMesh Pro' started by cenker, Mar 6, 2017.

  1. cenker

    cenker

    Joined:
    Oct 26, 2012
    Posts:
    45
    I'm making text based game and my options in game aren't fit well. Someones should be bigger for see text and someones should be smaller.I can't do with selection grid .Any opinion?

    May i must use toggle but toggle in GUI not grouped so it will not change other toggle. Reason of cancer..
     
  2. cenker

    cenker

    Joined:
    Oct 26, 2012
    Posts:
    45
    toggle isn't possible when number of options are not stable . It cause creating new bool object on GUI over and over ( -.- )
     
  3. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,078
    All your problems can be solved, I am sure.
    To start with the first question: you can assign a toggle group to your toggles. All toggles of the same toggle group behave like radio buttons then (I think that is what you are looking for). You just have to add one Toggle Group to a game object (e.g. the parent of the toggles) and assign it to the toggle group object fields in all toggles.

    your second problem: not sure exactly what the problem is. It is possible to create your toggles via code (UnityEngine.Object.Instantiate(prefab, parent, false)).
     
  4. cenker

    cenker

    Joined:
    Oct 26, 2012
    Posts:
    45
    I must use GUILayout because get strings from XML that unclear how many and changing therefore I cant use UI editor for show strings. And there isn't toggle group in guilayout but selectionGrid .With selectionGrid ,size of buttons are same but some of my strings are long for button .It cause switch text clipping clip to overflow for show text
    hgf.PNG

    Actually :D I just looked for word wrap and opened it but size of button didnt changed so i use custom toggle group for show strings
    gfv.PNG
     
  5. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,078
    looks like your using the legacy UI of unity.
    This forum is for the new UI system.

    BTW: For games there is no reason to use the old system at all... it is ugly and bad in performance. you should seriously consider to switch to the new UI system.
     
  6. cenker

    cenker

    Joined:
    Oct 26, 2012
    Posts:
    45
    uh I was think IMGUI is new system that use GUILayout.Label and old system like GUI.Label. So scripting is old system?
     
    Last edited: Mar 10, 2017
  7. cenker

    cenker

    Joined:
    Oct 26, 2012
    Posts:
    45
    I switched to new system . this is still not fixed . I know opening min size on "vertical fit" manually . But it must be automatically because long of my text are not same and min size do unnecessary space in between toggles dj.jpg
    fhgdg.PNG