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
1
Question by andresp · Nov 11, 2011 at 02:09 PM · guiwindowsguilayout

GUI: Windows inside Windows

Is it possible to have a window generated by pressing a button (from a set of buttons which produces only one window at a time) inside a generated window?

I can't find a way to get this to work. Sometimes some of the buttons create a window, while other times they just don't work.

I have created a unity package with a minimalistic test scene where this problem occurs. You can download it here:

http://feupload.fe.up.pt/get/MhGJhplt45EjkFP

EDIT - Example 2: I have just reduced this to the simplest case possible, a window inside a window. This correctly renders both of the windows, but it still shows a runtime error on the console. I suppose Unity can't handle Windows inside Windows.

using UnityEngine;

public class Test : MonoBehaviour {

  void OnGUI() {
      GUILayout.Window(0, new Rect(0, 0, 200, 300), OnGUIWindow, "Parent");
  }
  void OnGUIWindow(int windowID) {
      GUILayout.Label("Parent");
      GUILayout.Window(1, new Rect(0, 0, 100, 150), drawWindow, "Son");     
  }
  void drawWindow(int windowID) {
      GUILayout.Label("Son");
  }

}

Errors:

InvalidOperationException: Hashtable.Enumerator: snapshot out of sync.

ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint

Comment
Add comment · Show 4
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 3D-Magic-VR · Nov 11, 2011 at 11:21 PM 0
Share

Why do you need a window inside an other window?, I don't get it, it's to use in a game or an editor script?, because if it's for a game you don't need that, it's better to use individuals windows than one inside another, it's my point of view of course.

avatar image andresp · Nov 11, 2011 at 11:49 PM 0
Share

this is not intended for a typical game. it's more like a 3d viewer. in this particular case there is a filter window with layers/groups of models, and I'm trying to implement a color picker to set the color of each layer/group... a window (color picker window) inside a window (layers/groups window). anyway I've managed to workaround this problem by creating a Windows$$anonymous$$anager concept where I add new windows whenever I want to show a new dialog. but still, it's a strange limitation of Unity imo.

avatar image yoyo · Jun 08, 2012 at 12:17 PM 0
Share

Nested windows make perfect sense, for screen real-estate management if nothing else. Child window ought to be positioned relative to the parent (and drag with it, etc.) But you're right, it doesn't appear to work this way -- I get the same error you mention above (with Unity 3.5.2f2).

avatar image Berenger · Jun 08, 2012 at 02:10 PM 0
Share

Same for me. Don't understand why so, this is quite annoying. That kind of exception occurs when you remove an element from a list you're iterating through.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by GregBlast · May 15, 2016 at 02:59 PM

When I decided to make a drop-down control I chose to make a popup manager which is a MonoBehaviour of its own and is in charge of rendering any popup window that is open. Thanks to "GUI.BringWindowToFront" it can keep the popups above the window onto which the drop-down control is placed.

So basically I have a TextField and a Button. When the button is pressed it registers a popup to be opened below the TextField. This way the window can overlap anything defined below in the layout and also get out of the main window bounds.

I've made a few videos already. It works pretty well I think.

https://youtu.be/egT2CpODbw4

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

6 People are following this question.

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

Related Questions

GUILayout Window Help 1 Answer

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

GUILayout formatting help 1 Answer

GUILayout Textfield not editable just static 1 Answer

Using treeview OnGUI with GUIlayout 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