• 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 /
This question was closed Apr 17, 2014 at 02:14 PM by ChrisJoosten for the following reason:

Other

avatar image
0
Question by ChrisJoosten · Apr 17, 2014 at 01:53 PM · c#gui.boxinsidegui.window

GUI.Window

Hi Guys,

Is it possible to make a GUI.Box inside a GUI.Window? And how do I do this?

Because I want to make a help window in my game, that is resizable, draggable, toggable and able to scroll through the text.

Thanks in advance

Comment
Add comment · Show 1
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 thornekey · Apr 17, 2014 at 02:17 PM 0
Share

yes, of course it is possible. Have you checked the reference section? I think not.

At least try to start or produce some code.

http://docs.unity3d.com/Documentation/ScriptReference/GUI.DragWindow.html

https://docs.unity3d.com/Documentation/ScriptReference/GUI.BeginScrollView.html

https://docs.unity3d.com/Documentation/ScriptReference/GUI.TextArea.html

and for just a window with a box.

     public Rect windowDimension = new Rect(20, 20, 240, 100);
     void OnGUI() {
         windowDimension = GUI.Window(0, windowDimension, Windowthing, "Name of it");
     }
     void Windowthing(int windowID) {
         if (GUI.Box(new Rect(10, 20, 100, 20), "ma box")) {
 stuff 
       
         
     }
 }

im sure its obvious now how to implement with that first link.

Good luck

1 Reply

  • Sort: 
avatar image
0

Answer by Shrall Pyro · Apr 17, 2014 at 02:51 PM

hi, I've look the Doc, and I've found the solution; look here about the GUI.Window and here for the GUI.Box.

Try this code :

     public Rect windowRect = new Rect(20, 20, 120, 50);
     void OnGUI() 
     {
         windowRect = GUI.Window(0, windowRect, DoMyWindow, "GUI.Window");
     }
     void DoMyWindow(int windowID) 
     {
         GUI.Box(new Rect(10, 20, 100, 20), "GUI.Box");        
     }


i hope it can help you :)

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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

22 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Changing GUI.Box opacity 3 Answers

Help with GUI.Box Problem? 1 Answer

Flip over an object (smooth transition) 3 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