Updating to 4.5 from 4.3.4 is causing a crashing error when loading most scenes in our game. Whenever loading them in game or trying to open the Editor scene files, it causes:
Fatal Error
The file ‘MemoryStream’ is corrupted! Remove it and launch unity again!
[Position out of bounds! 20 > 16]
UnityEditor.DockArea:OnGUI()
Looked up other instances where a similar error occurred for people, but it seems to be something different. It’s also really odd that it happened on the switch over to 4.5.
Tried deleting Unity and reinstalling, but didn’t have any effect.
Happens on both Macbook Pro 9,1 with latest Mavericks and PC running Windows 7 Ultimate.
I personally was getting this error when changing Asset Serialization from ‘Mixed’ to ‘Force Text’, but it seems to be triggered by a number of things. In the end, the root cause does indeed seem to be a missing reference. So I found and used a script to find all prefabs with missing references in my project and either fixed or removed them, and the error went away.
For some of us (like me) with a prefab with a large number of objects (and several hundred missing scripts) simply finding them with a script, and removing them manually through the UI just isn’t good enough. For anyone else in this situation, If you have your asset serialization forced to text, you can do the following:
Find one of your objects with the missing monobehaviour
Give it a completely unique name.
Using Notepad++ or another text editor you like, open the prefab file, and search for the unique name.
Copy and save somewhere else the list of component references in the gameobject.
They will look like this:
m_Component:
4: {fileID: 400008}
33: {fileID: 3300008}
23: {fileID: 2300008}
64: {fileID: 6400000}
65: {fileID: 6500006}
Using the unity editor, manually remove the missing monobehaviour.
Ensure that the prefab / project have been saved
Load the prefab file in your text editor (if you left it open, ensure it has updated)
Search again for your unique name
Look at the component references, compare them to the ones you saved in step 4, and determine which one is no longer present (the one with the missing reference).
Do a find / replace in your text editor to replace the bad component reference with an empty string (basically removing it).
Now all objects within the prefab are free of the missing monobehaviour reference which was causing the error.
I Strongly suggest you backup the prefab first, in case something goes wrong. In our case, we just use source control.
I started getting this recently in 5.0.2. It just happens at random on the start of the editor. Unity will crash over and over popping up new Crash Reporters each time. After a force close and re-open, Unity will have several other permanent errors relating to UnityEngine.dll (I didn’t take a screen shot of the errors to be more precise.) All monobehavior references are corrupted and basically the project is completely broken no matter how many times you restart Unity. Fortunately, deleting the Library and Obj folders in the project fixes it. After Unity rebuilds the library, all is well.
This has happened twice to me so far, once today and once yesterday. The project is fairly simple and the scene loaded at start is extremely simple. I’ve never seen this bug in 4.x.
I had this with 5.1.2. The steps to produce it were I disabled a scene in build settings and move it to a new folder. Then I started the game and got this message.
Interesting: After restarting Unity I ran into the following error (not the first time): UnityEditor.Networking.dll’ is in timestamps but is not known in assetdatabase…
The workaround from this thread helped to get it working again.
We had to downgrade 5.2.0p1 to 5.1.3p3 because of some lingering brokenness in the 5.2 release. Hit this error and the above worked for us. (Note: on first load Unity still crashed after deleting /Temp and /Library but on second load we were back in business)
Updated to Unity 5.2.2f1 this morning hoping that some of the suck was gone… and sure enough it wasn’t! Had to downgrade back to 5.1.3p3 again and revisit this forum post for the third time to remember what it was we do to fix this error when downgrading back to a usable release.
It’s not from a broken prefab.Can’t find the source of the problem…
Edit: Found it! It was a missing prefab in a scene object.
Edit 2: Meh…It’s not from a missing prefab…In my case crashes when changing Editor->UnityRemote->Device-> iPhone4s. Then when restarting Unity and hitting Play it crashes and i have to delete the Library and Temp. Now Unity Remote became unusable…
Fixed (for git): Rather than deleting the Library folder, go into your git UI (I use SourceTree) and stage the current Library folder. Once it’s staged, right click and select “Reset To Commit”. Open Unity and run your game.