Search Unity

Bug Script File turns into text file because of error: UnityEditor.AssetDatabase:Refresh()

Discussion in 'Asset Database' started by slowDrag0n, Apr 1, 2020.

  1. slowDrag0n

    slowDrag0n

    Joined:
    Oct 10, 2017
    Posts:
    41
    The editor turns a random script files(most likely the ones that contain singletons or ones referencing the singletons) into text file and therefore all the references to this file start giving error. It gives these two errors when the file turns into text file:

    Cancelling DisplayDialog because it was run from a thread that is not the main thread: Opening file failed Opening file [PROJECT_DIRECTORY]/Assets/_Custom/Scripts/Data/ProgramDataManager.cs: The process cannot access the file because it is being used by another process.


    Code (CSharp):
    1. File couldn't be read!
    2. UnityEditor.AssetDatabase:Refresh()
    3. SyntaxTree.VisualStudio.Unity.Bridge.<>c:<Refresh>b__11_0()
    4. SyntaxTree.VisualStudio.Unity.Bridge.<>c__DisplayClass40_0:<RunOnceOnUpdate>b__0()
    5. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
    Upon selecting the script file the console keeps on loging this error as in update:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.EditorGUI.ObjectIconDropDown (UnityEngine.Rect position, UnityEngine.Object[] targets, System.Boolean showLabelIcons, UnityEngine.Texture2D nullIcon, UnityEditor.SerializedProperty iconProperty) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:4603)
    3. UnityEditor.MonoScriptImporterInspector.OnHeaderIconGUI (UnityEngine.Rect iconRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/MonoScriptInspector.cs:52)
    4. UnityEditor.Editor.DrawHeaderGUI (UnityEditor.Editor editor, System.String header, System.Single leftMargin) (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:856)
    5. UnityEditor.Editor.DrawHeaderGUI (UnityEditor.Editor editor, System.String header) (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:828)
    6. UnityEditor.Editor.OnHeaderGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:723)
    7. UnityEditor.Editor.DrawHeader () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:682)
    8. UnityEditor.InspectorWindow.DrawEditorLargeHeader (UnityEditor.Editor[] editors, System.Int32 editorIndex, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, UnityEditor.Editor editor, System.Boolean& wasVisible) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1558)
    9. UnityEditor.InspectorWindow.DrawEditorHeader (UnityEditor.Editor[] editors, System.Int32 editorIndex, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, UnityEditor.Editor editor, UnityEngine.Object target, System.Boolean& wasVisible) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1527)
    10. UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, System.Int32 editorIndex, System.Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1455)
    11. UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1330)
    12. UnityEditor.InspectorWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:655)
    13. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <e1319b7195c343e79b385cd3aa43f5dc>:0)
    14. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    15. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <e1319b7195c343e79b385cd3aa43f5dc>:0)
    16. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <e1319b7195c343e79b385cd3aa43f5dc>:0)
    17. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    18. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    19. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
    20. UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:361)
    21. UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:320)
    22. UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
    23. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
    24. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent () (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:412)
    25. UnityEngine.Experimental.UIElements.ImmediateStylePainter.DrawImmediate (System.Action callback) (at C:/buildslave/unity/build/Modules/UIElements/ImmediateStylePainter.cs:113)
    26. UnityEngine.Experimental.UIElements.IMGUIContainer.DoRepaint (UnityEngine.Experimental.UIElements.IStylePainter painter) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:98)
    27. UnityEngine.Experimental.UIElements.VisualElement.Repaint (UnityEngine.Experimental.UIElements.IStylePainter painter) (at C:/buildslave/unity/build/Modules/UIElements/VisualElement.cs:862)
    28. UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTree (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect currentGlobalClip) (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeRepaintUpdater.cs:310)
    29. UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTreeChildren (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect textureClip) (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeRepaintUpdater.cs:328)
    30. UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTree (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect currentGlobalClip) (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeRepaintUpdater.cs:314)
    31. UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeRepaintUpdater.cs:35)
    32. UnityEngine.Experimental.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:70)
    33. UnityEngine.Experimental.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:507)
    34. UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:230)
    35. UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
    36. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
    The error goes away fixing the file back to cs file by reimporting it but for some unknown reason the error comes back on the same or other files in the project
     
    unity_uKzpxnlps57FBQ likes this.