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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug ArgumentOutOfRangeException error persisting!

Discussion in 'VR' started by Myla9, Jun 28, 2023.

  1. Myla9

    Myla9

    Joined:
    Jul 7, 2022
    Posts:
    3
    I keep receiving this error everytime i right-click an element from a unity scene hierarchy. Does anyone know how to solve this? (I'm using this unity editor version: 2021.3.8f1 )

    ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
    Parameter name: startIndex
    System.String.Substring (System.Int32 startIndex, System.Int32 length) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
    System.String.Substring (System.Int32 startIndex) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
    UnityEditor.SceneHierarchy.AddCreateGameObjectItemsToMenu (UnityEditor.GenericMenu menu, UnityEngine.Object[] context, System.Boolean includeCreateEmptyChild, System.Boolean useCreateEmptyParentMenuItem, System.Boolean includeGameObjectInPath, System.Int32 targetSceneHandle, UnityEditor.MenuUtils+ContextMenuOrigin origin) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.SceneHierarchy.CreateGameObjectContextClick (UnityEditor.GenericMenu menu, System.Int32 contextClickedItemID) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.SceneHierarchy.ItemContextClick (System.Int32 contextClickedItemID) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.IMGUI.Controls.TreeViewController.HandleUnusedMouseEventsForItem (UnityEngine.Rect rect, UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.IMGUI.Controls.TreeViewController.DoItemGUI (UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row, System.Single rowWidth, System.Boolean hasFocus) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.IMGUI.Controls.TreeViewController.IterateVisibleItems (System.Int32 firstRow, System.Int32 numVisibleRows, System.Single rowWidth, System.Boolean hasFocus) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.IMGUI.Controls.TreeViewController.OnGUI (UnityEngine.Rect rect, System.Int32 keyboardControlID) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.SceneHierarchy.DoTreeView (System.Single searchPathHeight) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.SceneHierarchy.OnGUI (UnityEngine.Rect rect) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.SceneHierarchyWindow.DoSceneHierarchy () (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.SceneHierarchyWindow.OnGUI () (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEditor.DockArea.OldOnGUI () (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <e262c2d839014c8090373617ef295bab>:0)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <67dcbe01fcb94a00b87487037550ce1c>:0)
     
  2. jesliwang

    jesliwang

    Joined:
    Apr 1, 2013
    Posts:
    4
    I fixed this just by remove double "//". like MenuItem("GameObject//Some Func") to MenuItem("GameObject/Some Func")
     
  3. Myla9

    Myla9

    Joined:
    Jul 7, 2022
    Posts:
    3
    Where do you remove that from?