Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Reset in Editor Settings results in `IndexOutOfRangeException` and breaks version control on Windows

Discussion in 'Editor & General Support' started by unanema, May 7, 2017.

  1. unanema

    unanema

    Joined:
    May 7, 2017
    Posts:
    1
    While setting up my first environment with Unity I discovered a bug that made all options under 'Version Control' disappear from Editor Settings in inspector. I could still access VCS settings via debug but as I was not sure which values those settings accept, I simply reverted the change in EditorSettings.asset via SVN and it solved the problem.

    The bug may look boring, but how comes that Unity scans project folders for .svn and automatically changes VCS settings based on their existence? Note that I have "C:\Program Files\Unity\Editor\Data\Tools\VersionControl\SubversionPlugin.exe" file on my system and I didn't add it myself. Why does Unity 3.6 contain SubversionPlugin.exe in its installation directory? Is it the same SVN plug-in which source is available at https://bitbucket.org/Unity-Technologies/versioncontrolplugins ?


    I reproduce the problem with Unity 5.6.0f3 Personal on Windows 10 64-bit with any Unity project in SVN working copy. I don't use any special SVN extension in Unity. The reproduction is very simple -- I add my Unity project to Subversion and SVN places single hidden directory `.svn` to the root of my project. If I add an empty `.svn` directory manually via `mkdir .svn` Unity behaves a bit differently. But I think that you anyone could reproduce the problem just by checking out svn working copy with Unity project from the web. Here is an example:
    1. Make sure that you have svn client installed (e.g command line svn.exe or TortoiseSVN).
    2. Checkout any Unity project. For example, run

    3. Open the project in Unity (it should ask you to upgrade the project and that's OK).
    4. Go to Edit | Project Settings | Editor.
    5. Click 'gear' on the right side of Editor Settings inspector and click Reset.

    Getting this in console:
    IndexOutOfRangeException: Array index is out of range.

    And this in editor.log:
    IndexOutOfRangeException: Array index is out of range.
    at UnityEditor.EditorSettingsInspector.CreatePopupMenuVersionControl (System.String title, .PopupElement[] elements, System.String selectedValue, UnityEditor.MenuFunction2 func) [0x00021] in C:\buildslave\unity\build\Editor\Mono\Inspector\EditorSettingsInspector.cs:489
    at UnityEditor.EditorSettingsInspector.OnInspectorGUI () [0x00076] in C:\buildslave\unity\build\Editor\Mono\Inspector\EditorSettingsInspector.cs:177
    at UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) [0x0039d] in C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:1229
    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    UnityEngine.Logger:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    UnityEditor.InspectorWindow:DrawEditor(Editor, Int32, Boolean, Boolean&, Rect&) (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:1236)
    UnityEditor.InspectorWindow:DrawEditors(Editor[]) (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:1019)
    UnityEditor.InspectorWindow:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:358)
    System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
    System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono/build/mcs/ndexOutOfRangeException: Array index is out of range.
    at UnityEditor.EditorSettingsInspector.CreatePopupMenuVersionControl (System.String title, .PopupElement[] elements, System.String selectedValue, UnityEditor.MenuFunction2 func) [0x00021] in C:\buildslave\unity\build\Editor\Mono\Inspector\EditorSettingsInspector.cs:489
    at UnityEditor.EditorSettingsInspector.OnInspectorGUI () [0x00076] in C:\buildslave\unity\build\Editor\Mono\Inspector\EditorSettingsInspector.cs:177
    at UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) [0x0039d] in C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:1229
    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    UnityEngine.Logger:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    UnityEditor.InspectorWindow:DrawEditor(Editor, Int32, Boolean, Boolean&, Rect&) (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:1236)
    UnityEditor.InspectorWindow:DrawEditors(Editor[]) (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:1019)
    UnityEditor.InspectorWindow:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:358)
    System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
    System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:262)
    UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:255)
    UnityEditor.HostView:InvokeOnGUI(Rect) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:222)
    UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:346)
    (Filename: C:/buildslave/unity/build/Editor/Mono/Inspector/EditorSettingsInspector.cs Line: 489)class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:262)
    UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:255)
    UnityEditor.HostView:InvokeOnGUI(Rect) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:222)
    UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:346)
    (Filename: C:/buildslave/unity/build/Editor/Mono/Inspector/EditorSettingsInspector.cs Line: 489)


    I looked into Editor Settings 'debug' and External Version Control was set to Subversion. If I save the changes and re-open the project I will receive these warning and error in console:

    Unknown version control plugin: Subversion

    Cannot load Subversion overlays when plugin is not running

    All this made me curious how Unity determines that the project is in SVN working copy. I ran procmon on project startup and unity.exe checks for ".svn" on startup:
    Path:
    C:\Users\user1\Documents\New Unity Project 11\.svn
    Stack:
    IsDirectoryCreated + 0x6f 0x141219f0f C:\Program Files\Unity\Editor\Unity.exe
    DetectVersionControl + 0x86 0x1405ef936 C:\Program Files\Unity\Editor\Unity.exe
    DetectVersionControl + 0x21 0x1405f1581 C:\Program Files\Unity\Editor\Unity.exe
    EditorSettings::SmartReset + 0x38 0x141734718 C:\Program Files\Unity\Editor\Unity.exe
     
  2. DrakharStudio

    DrakharStudio

    Joined:
    Mar 2, 2012
    Posts:
    8
    Hello!

    We had the same problem and found a workaround for it. We manually modified the content of the EditorSettings.asset file. We copied them from another project.

    This is the content we copied:

    Code (YAML):
    1. %YAML 1.1
    2. %TAG !u! tag:unity3d.com,2011:
    3. --- !u!159 &1
    4. EditorSettings:
    5.   m_ObjectHideFlags: 0
    6.   serializedVersion: 1
    7.   m_ExternalVersionControlSupport: 1
    8.   m_SerializationMode: 2
    9.   m_WebSecurityEmulationEnabled: 0
    10.   m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d
    11.  
     
    Threeyes and ayushbherwani like this.