Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by sydan · Jan 13, 2013 at 01:17 PM · guisizeguilayoutrect

Finding the available space in a GUILayout.

Let's say that we've set up a GUILayout area that's 200 by 20 in size and put two horizontal areas within it so that each is (roughly) 200 by 100 in size (but not exact). How can I find out how much space is actually available within each of those horizontal draw areas?

I've tried using GetLastRect but it doesn't seem to do what I want...

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by whydoidoit · Jan 13, 2013 at 02:49 PM

GUILayout is designed so that you don't need to know those things! During the repaint phase the GetLastRect immediately after the EndHorizontal will contain the rectangle, but it will be empty during the layout phase - which is where things are positioned.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image whydoidoit · Jan 13, 2013 at 02:50 PM 1
Share

It would probably help to understand what you are trying to do...

avatar image sydan · Jan 13, 2013 at 03:29 PM 0
Share

I have built a set of classes that enclose and use GUILayout calls to simplify the creation of lots of dynamic GUI panels. I used GUILayout because it creates a very easy environment to construct complex arrangements of GUI objects on the fly. $$anonymous$$ostly everything will be dynamically sized, sometimes how it would be nice to say that a box should be say 1/3 of the size of the space it has available. I know I can set the box size, but I don't know how to find out what the total space available is...

avatar image
0

Answer by Bunny83 · Jan 13, 2013 at 07:11 PM

If you want to distribute the size of an area of a layouted GUI manually, you can use the "normal" GUI. Just use GUILayoutUtility.GetRect to register the whole area and then just use normal GUI elements and arrange them in the Rect as you like.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to change thickness of ScrollBar of GUILayout ScrollView? 0 Answers

How to set rectangle size in GUILayout 0 Answers

Why can't I get my tooltip to show only when there is a tooltip set? 2 Answers

GUIBox fontSize without changing other labels? 3 Answers

GUI.Window error. InvalidOperationException: Hashtable.Enumerator: snapshot out of sync. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges