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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

[SOLVED] Custom inspector too tall causes horizontal scrollbar?

Discussion in 'Immediate Mode GUI (IMGUI)' started by toastertub, Dec 2, 2018.

  1. toastertub

    toastertub

    Joined:
    Oct 28, 2013
    Posts:
    25
    Hello all.

    While working on a custom inspector, if I have too many options and it makes the inspector taller than my screen, It stretches the inspector. It about doubles the width and puts a horizontal scroll bar at the bottom.


    If I hide some options, it doesn't matter what ones, just as long as the inspector is shorter than my monitor, then it's all fine.
    Not Stetchy.png


    But if I show more options and the inspector gets too tall, it stretches the whole thing, it even stretches out the other components.

    stretchy inspector.png


    I've been messing with this for a few hours, trying to find what I did wrong in my code, but it doesn't seem to matter what options I show or hide, it just depends on the height of the inspector.

    Does anyone know what to do with this, or has anyone fixed this before?

    It's causing my ScrollViews to stretch off of the screen, no matter what size I give them as GUILayout.Width it just ignores it while the inspector is stretching.
     
  2. toastertub

    toastertub

    Joined:
    Oct 28, 2013
    Posts:
    25
    I seem to have found it. In some areas I had used GUILayout.width() on buttons inside of a GUILayout horizontal area, and taking those out is the only thing that fixed it. It seems I can do anything else inside of a horizontal layout area.
     
  3. MeadowGames

    MeadowGames

    Joined:
    Dec 15, 2013
    Posts:
    11
    Hi Toastertub, I have the same problem across all versions of Unity 5.4 - 2018.4.How on earth can people not notice? I finally became so annoyed to the point that I had say something. Its irritating to have to scroll right up left down to get to my settings because of this auto window auto stretch. Why can't the damn thing just stay in one place really? The GUILayout thing ain't working for me unfortunate. Maybe it's time to submit a bug.