the file 'c:/Test/Test_Data/Level0' is corrupted! Remove it and launch Unity again!

I’ve been plugging away for a couple of months on a test UI for the backend DLL i’m working on for an RPG rules engine. Tonight, I tried to do a stand-alone build so I could send it off to some testers.

I did my build and fired it up, only to be greeted by the message "The File ‘C:/test/test_Data/level3’ is corrupted! Remove it and launch unity again! [Position is out of bounds!]

I’m not getting any unhandled exceptions when i run it through the unity IDE. None of the searches I did yielded anything helpful. the game doesn’t crash, but i start getting all kinds of object reference not set to an instance of an object errors and i suspect it’s not able to access objects that should be part of a singleton in my rules engine DLL.

I’m using 5.6.1f1

I pulled this out of the log file

The file ‘C:/test/test_Data/level6’ is corrupted! Remove it and launch unity again!
[Position out of bounds!]

(Filename: C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp Line: 220)
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 1.679840 ms
System memory in use before: 22.2 MB.
System memory in use after: 22.1 MB.

Unloading 5 unused Assets to reduce memory usage. Loaded Objects now: 1680.
Total: 1.085573 ms (FindLiveObjects: 0.061317 ms CreateObjectMapping: 0.027848 ms MarkObjects: 0.982866 ms DeleteObjects: 0.013029 ms)

NullReferenceException: Object reference not set to an instance of an object
at SkillsCombat.Start () [0x000f2] in C:\TFS\VsProjects\GameEngine\UnityProject\Assets\Scripts\UIScripts\SkillsCombat.cs:83

skillsCombat is a script in my unity project that is attempting to access the singleton in my DLL

well, after tinkering and tinkering… as near as I can tell, i had an inactive object which had a reference to a script I had removed from my project a while back. removed the inactive game object entirely and I seem to be in business now.

1 Like

I have experienced this exact same bug in Unity 2018.3.0f2. However, in my case, I had to change the stereo rendering mode and the scripting runtime version from .Net 3.5 to .Net 4.X.

I found that if I created a new blank scene the build would work. So I copied the contents of my scene that was causing the level0 corrupted problem and pasted its contents into my new blank scene. It worked fine after that.

I’m running 2022.3.5.f1 and getting the same error
"WindowsPlayer “MAIN” The file ‘…Data/level0’ is corrupted! Remove it and launch unity again!
[Position out of bounds!]
"
I’ve even tried moving everything into a blank scene.

Any other suggestions? Why is Unity Compiler building a bad file?

If I delete the Level0 file, the program runs, but nothing happens.

Got the same error and none of the fixes here or elsewhere worked so far. Starting to really dislike Unity for its useless error messages when it crashes.

Got the same issue and none of the workarounds described here worked. Eventually tracked it to the fact that, for some reason, at some point, my runtime code added an not-globally-reachable MonoBehaviour component to some gameobjects (the MonoBehaviour class is defined locally inside another class). That works fine at runtime, but I missed the fact that in some cases my script runs in the editor and attaches this MonoBehaviour to editor-level scene objects too. So the issue that ends in a corrupted file is the presence of this bogus MonoBehaviour in the scene data. (This precise condition appears to be not enough, because randomly it still works.)