• 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 BerggreenDK · Aug 21, 2011 at 09:32 PM · c#wwwexceptionargumentexception

Strange error when calling WWW within a GUI element?

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

Aborting

Say what?! huh?

Been trying to figure out what this control 0 is or why my GUI suddently should be empty?

I have a HUGE switch(state) thing going on in my GUI so that I dont waste a lot of IF.. THEN structures on testing all the time.

And it works like a charm. Until now.

Reason is that I call a "storage script" that uses WWWFORM and WWW to send my data to the webserver while it also switches state so that the GUI will say: "saving..." while we wait for the WWW to return a flag.

The state machine works perfectly (I think) as everything but the actual update when the data returns runs.

But I cant find any documentation on error codes? anyone familiar with this one?

I use GUILayout for all my states, thats any help. I'll post some code if neccesary, but I think the best solution for me would be if someone can explain what the error is about.

Then I will be able to track down the problem.

Note. I have triplechecked that I dont have too many or to few Begin/End Area/view etc. I've even moved the saving state outside the GUI to see if that would remove my error. But no luck.

The faulty state is the primary state that runs from start. It works perfectly until I press "save". Infact the GUI keeps running, so its not a fatal error?

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
2
Best Answer

Answer by Bunny83 · Aug 21, 2011 at 11:45 PM

That's what you should avoid state changing events in OnGUI. The problem is that OnGUI is always called twice. It performs a layouting call where Unity writes all elements you "draw" into a temporary list and after that step Unity can distribute the width / height to the elements. In the second repaint call the actual drawing and logic processing is performed. If you change the "things" you draw between those two calls the internal list will not match with the elements you want to draw...

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 Bunny83 · Aug 21, 2011 at 11:46 PM 0
Share

btw, some code would help to spot the point where the elements are scrambled ;)

avatar image BerggreenDK · Aug 22, 2011 at 08:21 PM 0
Share

Perfect explanation, I am sure this is why then. Only thought OnGui was called once. Dang! what a strange behaviour.

avatar image
0

Answer by efge · Sep 09, 2012 at 07:59 AM

Here is a forum thread to this topic.

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.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

[SOLVED] Cannot create FMOD: Sound instance for resource End of file unexpectedly reached while trying to read essential data,Cannot Create FMOD Sound Instance For Resource 1 Answer

ArgumentException: method return type is incompatible 2 Answers

InvalidProgramException: Invalid IL code with Mono.Cairo on MacOS 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