Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[SOLVED] Custom inspector too tall causes horizontal scrollbar?

Discussion in 'Extensions & OnGUI' started by toastertub, Dec 2, 2018.

  1. toastertub

    toastertub

    Joined:
    Oct 28, 2013
    Posts:
    14
    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:
    14
    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.