Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 jmparavicini · Apr 21, 2016 at 09:43 AM · errorinspectoreditor-scriptingargumentexception

Unable to solve: ArgumentException: Getting control 3's position in a group with only 3 controls when doing Repaint Aborting

Hey everyone, Ok ok i know this was asked many times. However i wasn't able to find any solution in the other threads.

First of all here is my editor script, or at least the important part:

 public override void OnInspectorGUI()
     {
         serializedObject.Update ();
         elements = EditorGUILayout.PropertyField (serializedObject.FindProperty ("publicScenes"), false);
         serializedObject.ApplyModifiedProperties ();
 
         EditorGUI.indentLevel += 1;
 
         if (elements)
         {
             for (int count = 0; count < myScript.publicScenes.Count; ++count)
             {
                 if (showPublicScenesElement.Length != myScript.publicScenes.Count)
                 {
                     if(Event.current.type == EventType.Repaint)
                         UpdateScenesElementBools ();
                 }
                 else
                 {
                     showPublicScenesElement [count] = EditorGUILayout.Foldout (showPublicScenesElement [count], "Element " + count);
                     
                 }
             }
         }
         EditorGUI.indentLevel -= 1;
 
         if (GUILayout.Button ("Update Level buttons Animation"))
         {
             myScript.UpdateLevelAnimation ();
         }
         if (GUILayout.Button ("Recreate Buttons"))
         {
             myScript.RecreateButtons ();
         }
     }

At the beginning i had the same error but with a 9 instead of a 3 and i managed to solve part of this problem by adding the following line on line 15:

  if(Event.current.type == EventType.Repaint)

The problem persisted but now i could't find any simple solution. I tried many things and with commenting out a lot of my code i found out that the problem is by the foldout at line 20. Does anyone know how to get rid of this error. I am actually going crazy.

Thanks in advance -Jorge

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 rodude123 · Apr 21, 2016 at 09:50 AM 0
Share

what are you using the repaint function for, and also you should check out this for your solution. I had the same problem with my game but I figured it out using this.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Soraphis · Apr 21, 2016 at 10:16 AM

 .....
 if (elements) {
     if (showPublicScenesElement == null || 
         showPublicScenesElement.Length != myScript.publicScenes.Count) {
         showPublicScenesElement = new bool[myScript.publicScenes.Count];
     }
                 
     for (int count = 0; count < myScript.publicScenes.Count; ++count) {
         showPublicScenesElement[count] = EditorGUILayout.Foldout(showPublicScenesElement[count],
             "Element " + count);
     }
 }
 ....

you should'nt update your bool[] "showPublicScenesElement" inside the loop. i dont know if this will fix your problem... but just consider: what if the array lenghts of those lists are not the same, and the event called is not repaint?

Comment
Add comment · Show 1 · 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 jmparavicini · Apr 21, 2016 at 10:31 AM 0
Share

Thanks a lot, I didn't even think about this line anymore because the i added the repaint check the error number went down from 9 to 3 so i thought it didn't have anything to do with it. You just made my day :)

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

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

Related Questions

Custom Inspector Enum 1 Answer

TexturePropertySingleLine in Editor class 0 Answers

Draw specific Object Inspector into Rect 1 Answer

Change the target of inspector from script 0 Answers

Create inspector drop-down button based on the content of a list in editor mode 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