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’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Bug InvalidCastException in the editor

Discussion in '2021.2 Beta' started by Wattosan, Sep 21, 2021.

  1. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    450
    Hello,

    On my almost every action I do in the editor I get the InvalidCastException or ArgumentNullException. When trying to press a button, open a window or whatever else.

    This is my normal editor console:
    upload_2021-9-21_10-52-3.png

    This happened when I clicked "Fix Selected Issues" in the Adressables Analyze window.
    InvalidCastException: Specified cast is not valid.
    (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
    System.Linq.Enumerable+<CastIterator>d__34`1[TResult].MoveNext () (at <6db93e44953a44ec9dcacc4ba86c2139>:0)
    UnityEditor.Localization.Addressables.TableAnalyzeRule`1[TTable].FixIssues (UnityEditor.AddressableAssets.Settings.AddressableAssetSettings settings) (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Editor/Addressables/StringTableAnalyzeRule.cs:222)
    UnityEditor.AddressableAssets.Build.AnalyzeSystem.FixIssues (UnityEditor.AddressableAssets.Build.AnalyzeRules.AnalyzeRule rule) (at Library/PackageCache/com.unity.addressables@1.18.15/Editor/Build/AnalyzeRules/AnalyzeSystem.cs:193)
    UnityEditor.AddressableAssets.GUI.AssetSettingsAnalyzeTreeView.<FixAllSelectedRules>b__5_0 (UnityEditor.AddressableAssets.GUI.AnalyzeRuleContainerTreeViewItem ruleContainer) (at Library/PackageCache/com.unity.addressables@1.18.15/Editor/GUI/AssetSettingsAnalyzeTreeView.cs:81)
    UnityEditor.AddressableAssets.GUI.AssetSettingsAnalyzeTreeView.PerformActionForEntireRuleSelection (System.Action`1[T] action) (at Library/PackageCache/com.unity.addressables@1.18.15/Editor/GUI/AssetSettingsAnalyzeTreeView.cs:60)
    UnityEditor.AddressableAssets.GUI.AssetSettingsAnalyzeTreeView.FixAllSelectedRules () (at Library/PackageCache/com.unity.addressables@1.18.15/Editor/GUI/AssetSettingsAnalyzeTreeView.cs:79)
    UnityEditor.AddressableAssets.GUI.AnalyzeRuleGUI.<OnGUI>b__3_2 () (at Library/PackageCache/com.unity.addressables@1.18.15/Editor/GUI/AnalyzeRuleGUI.cs:49)
    UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at <76a445b462cc49e2975056a950390db7>:0)

    ArgumentNullException: Value cannot be null.
    Parameter name: source
    System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at <6db93e44953a44ec9dcacc4ba86c2139>:0)
    System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value) (at <6db93e44953a44ec9dcacc4ba86c2139>:0)
    UnityEditor.PreferencesProvider.FilePopup (UnityEngine.GUIContent label, System.String selectedString, System.String[]& names, System.String[]& paths, UnityEditor.PreferencesProvider+RefString outString, System.String defaultString, System.Action onChanged, UnityEditor.EditorUtility+SelectMenuItemFunction ApplicationsListOnClick) (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.PreferencesProvider.ShowExternalApplications (System.String searchContext) (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.PreferencesProvider.OnGUI (System.String searchContext, System.Action`1[T] drawAction) (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.PreferencesProvider+<>c__DisplayClass71_0.<CreateExternalToolsProvider>b__0 (System.String searchContext) (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.SettingsProvider.OnGUI (System.String searchContext) (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.SettingsWindow.DrawControls () (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.SettingsWindow.DrawSettingsPanel () (at <76a445b462cc49e2975056a950390db7>: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 <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    InvalidCastException: Specified cast is not valid.
    UnityEditor.EditorGUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, System.Boolean alwaysShowHorizontal, System.Boolean alwaysShowVertical, UnityEngine.GUIStyle horizontalScrollbar, UnityEngine.GUIStyle verticalScrollbar, UnityEngine.GUIStyle background, UnityEngine.GUILayoutOption[] options) (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.EditorGUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, UnityEngine.GUILayoutOption[] options) (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.EditorGUILayout+ScrollViewScope..ctor (UnityEngine.Vector2 scrollPosition, UnityEngine.GUILayoutOption[] options) (at <76a445b462cc49e2975056a950390db7>:0)
    UnityEditor.SettingsWindow.DrawSettingsPanel () (at <76a445b462cc49e2975056a950390db7>: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 <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <f68bef9660d34944b32d30927b669404>:0)
    Rethrow as ImmediateModeException
    UnityEngine.UIElements.UIR.RenderChain.Render () (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.Panel.UpdateForRepaint () (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <f68bef9660d34944b32d30927b669404>:0)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <ae7f5af45fd74d6f8ef88ea586136af6>:0)

    Could not Move to directory Library/com.unity.addressables/aa/Android, directory arlready exists.
    UnityEngine.Debug:LogError (object)
    DirectoryUtility:DirectoryMove (string,string) (at Library/PackageCache/com.unity.addressables@1.18.15/Editor/Build/DirectoryUtility.cs:35)
    AddressablesPlayerBuildProcessor:CleanTemporaryPlayerBuildData () (at Library/PackageCache/com.unity.addressables@1.18.15/Editor/Build/AddressablesPlayerBuildProcessor.cs:35)
    UnityEditor.EditorAssemblies:processInitializeOnLoadMethodAttributes ()