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 /
This question was closed Dec 19, 2012 at 02:51 PM by KiraSensei for the following reason:

Other

avatar image
0
Question by KiraSensei · Dec 09, 2012 at 04:06 PM · guiwindow

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

Hello !

I got this error when I tried to handle a dialog score and an chat script together. They are in different scripts.

My chat dialog is always visible, and my dialog score is only visible when the user pushes the "tab" button. Each dialog works fine (I can see the score dialog if I press "tab" and if my chat dialog is inactive, and I can see my chat dialog if I don't press the "tab" button), but not together ...

I saw this question and I think I understand the explanation, but I don't know how to correct the problem. So if someone can help me, I'd be grateful :)

Here is the code for the chat dialog :

 function OnGUI() {
     if (loadedLevel != Application.loadedLevel)
     {
         loadedLevel = Application.loadedLevel;
         if (loadedLevel == 4) windowChat = Rect(0.7*Screen.width, 0.8*Screen.height, 0.3*Screen.width, 0.2*Screen.height);
     }
     else if (gameOver) windowChat = Rect(0.5*Screen.width, 0, 0.5*Screen.width, Screen.height);
     
     windowChat = GUI.Window (0, windowChat, GlobalChatWindow, "Chat");
 }
 
 function GlobalChatWindow (id : int) {
     scrollPosition = GUILayout.BeginScrollView (scrollPosition);
 
     for (var entry : ChatEntry in entries)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label(entry.text);
         GUILayout.FlexibleSpace ();
         
         GUILayout.EndHorizontal();
         GUILayout.Space(3);
         
     }
     // End the scrollview we began above.
     GUILayout.EndScrollView ();
     
     if (Event.current.type == EventType.keyDown && Event.current.character == "\n" && inputField.Length > 0)
     {
         inputField = myNickname + ": " + inputField;
         ApplyGlobalChatText(inputField, 1);
         networkView.RPC("ApplyGlobalChatText", RPCMode.Others, inputField, 0);
         inputField = "";
     }
     GUI.SetNextControlName("Chat input field");
     inputField = GUILayout.TextField(inputField);
 }
 
 @RPC
 function ApplyGlobalChatText (str : String, mine : int)
 {
     var entry = new ChatEntry();
     entry.sender = "Not implemented";
     entry.text = str;
 
     entries.Add(entry);
     
     if (entries.Count > 50)
         entries.RemoveAt(0);
         
     scrollPosition.y = 1000000;    
 }

It is quite the same code from the tutorials...

The problem happens when I try to display my score dialog too, here is the code :

 function OnGUI() {
     if (Input.GetKey(KeyCode.Tab)) enableScoreDlg = true;
     if (Input.GetKeyUp(KeyCode.Tab)) enableScoreDlg = false;
 }
 
 function OnGUI() {
     if (enableScoreDlg)
     {
         scoresDlg = GUI.Window(0, Rect (0.1*Screen.width, 0.1*Screen.height, 0.8*Screen.width, 0.8*Screen.height), ScoreWindow, "", scoreSkin.window);
     }
 }

EDIT : I finally managed to have my chat dialog and my scores dialog work, but not together ...

Now my script handling the chat is like :

 function OnGUI() {
     if (Event.current.type == EventType.Layout) windowChat = GUI.Window (0, windowChat, GlobalChatWindow, "Chat");
 }

And my script handling my score dialog is like :

 function OnGUI() {
     if (enableScoreDlg)
     {
         scoresDlg = GUI.Window(0, Rect (0.1*Screen.width, 0.1*Screen.height, 0.8*Screen.width, 0.8*Screen.height), ScoreWindow, "", scoreSkin.window);
     }
 }

with enableScoreDlg true only when the user uses the "tab" key. My problem now is that there is never both the windows together. If the user presses "tab", the chat window disappears and my score dialog appears, when he releases it, my score dialog disappears and the chat reappears... What is wrong ?

Comment
Add comment · Show 2
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 Demigiant · Dec 11, 2012 at 10:48 PM 0
Share

This problem happens because you have some GUILayout container that is not closed correctly, maybe because it break out of a loop at the wrong point. If you want more help, you should post your code so we can see where it is wrong.

avatar image KiraSensei · Dec 17, 2012 at 10:15 AM 0
Share

What code do you need ?

0 Replies

  • Sort: 

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

Elements in draggable window do not remain fixed [SOLVED] 2 Answers

Add EditorUI elements when a button is pressed 0 Answers

Center GUI wondow or box in windowed mode 3 Answers

how to get Gui in OnGUI function to resize with the window? 1 Answer

Is it possible to have a spectrum analyzer display for each song in a playlist? 1 Answer


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