Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 4.5 Memory Stream is Corrupted

Discussion in 'Editor & General Support' started by a-lomo, May 27, 2014.

  1. a-lomo

    a-lomo

    Joined:
    Aug 5, 2012
    Posts:
    12
    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()

    Code (csharp):
    1.  
    2. == LOG FILE ==
    3. The file 'MemoryStream' is corrupted! Remove it and launch unity again!
    4. [Position out of bounds! 20 > 16]
    5. UnityEditor.AssetDatabase:OpenAsset(Int32, Int32)
    6. UnityEditor.AssetDatabase:OpenAsset(Int32)
    7. UnityEditor.ProjectBrowser:OpenAssetSelection(Int32[])
    8. UnityEditor.ProjectBrowser:OpenListAreaSelection()
    9. UnityEditor.ProjectBrowser:ListAreaItemSelectedCallback(Boolean)
    10. UnityEditor.ObjectListArea:SetSelection(Int32[], Boolean)
    11. UnityEditor.LocalGroup:HandleMouseWithDragging(Int32, Int32, Rect)
    12. UnityEditor.LocalGroup:DrawItem(Rect, FilterResult, BuiltinResource, Boolean)
    13. UnityEditor.LocalGroup:DrawInternal(Int32, Int32, Single)
    14. UnityEditor.Group:Draw(Single, Vector2)
    15. UnityEditor.ObjectListArea:HandleListArea()
    16. UnityEditor.ObjectListArea:OnGUI(Rect, Int32)
    17. UnityEditor.ProjectBrowser:OnGUI()
    18. System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception)
    19. System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    20. System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    21. UnityEditor.HostView:Invoke(String, Object)
    22. UnityEditor.HostView:Invoke(String)
    23. UnityEditor.DockArea:OnGUI()
    24.  
    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.
     
  2. Samuraisa

    Samuraisa

    Joined:
    Feb 28, 2013
    Posts:
    2
    The same problem and on 4.5 too. Win7 Ultimate x64.
    2014-06-02_174326.png
     
  3. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    Same issue with our project on both windows and mac after upgrading to 4.5
    Will have to downgrade to 4.3 :(

    Unity please fix the issue ASAP!
     
  4. a-lomo

    a-lomo

    Joined:
    Aug 5, 2012
    Posts:
    12
    The crashing levels had a Prefab with a Missing MonoBehavior. Removed the missing reference and it seems to be working now!
     
  5. agamedesigner

    agamedesigner

    Joined:
    Jul 21, 2012
    Posts:
    19
    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.

    You can find the script here: http://forum.unity3d.com/threads/ed...n-attached-monobehaviour.253149/#post-1673716
     
  6. AnalogSynth84

    AnalogSynth84

    Joined:
    Sep 26, 2012
    Posts:
    1
    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:

    1. Find one of your objects with the missing monobehaviour
    2. Give it a completely unique name.
    3. Using Notepad++ or another text editor you like, open the prefab file, and search for the unique name.
    4. 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}

    5. Using the unity editor, manually remove the missing monobehaviour.
    6. Ensure that the prefab / project have been saved
    7. Load the prefab file in your text editor (if you left it open, ensure it has updated)
    8. Search again for your unique name
    9. 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).
    10. 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 hope this helps people with this problem!
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    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.
     
    mstar_jwoodall likes this.
  8. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    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.
     
  9. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143
    I just had this problem and wiping the /Temp and /Library folders resolved it.
     
  10. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    This can happen occasionally when working from git repos. Advice as above always fixes it.
     
    mstar_jwoodall likes this.
  11. AndyKorth

    AndyKorth

    Joined:
    Oct 19, 2009
    Posts:
    41
    We had this problem when a team member opened a Unity 5.2 project with Unity 5.0.x. Be mindful of your project vs. Unity versions!
     
  12. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    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)
     
  13. chai

    chai

    Joined:
    Jun 3, 2009
    Posts:
    84
    Cheers, exact same situation with downgrading due to 5.2 bugs, 2nd load after temp/library did the trick.
     
  14. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Haha.. you guys got me again! :) !

    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.
     
  15. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    5.3 and it's still doing it, 3 times in one week and having to rebuild the two folders in a big project takes some time ..

    Unity really need to sort this out ..

    Then when it's rebuilt I then have to switch platforms because it defaults to PC and I'm using iOS ..

    Such a time waster, when I don't get much time on it anyway :(
     
    Last edited: Dec 28, 2015
  16. sysameca

    sysameca

    Joined:
    Mar 2, 2013
    Posts:
    99
    Same here 5.3.1
    The file 'MemoryStream' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]

    (Filename: C:/buildslave/unity/build/Runtime/Serialize/SerializationCaching/CachedReader.cpp Line: 217)

    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..
     
    Last edited: Dec 28, 2015
    TheWarper likes this.
  17. TheWarper

    TheWarper

    Joined:
    Nov 3, 2013
    Posts:
    112
    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.
     
    Griffo likes this.
  18. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    But this does not comply with Unity's recommendation to ignore the Library folder. Thus it blows up your repositories, s. the docs about Unity - Mastering Project Folder Structure - Version Control System:

    Instead of deleting I suggest the DLL trick as mentioned above, s.this forum post
     
    Griffo likes this.
  19. TheWarper

    TheWarper

    Joined:
    Nov 3, 2013
    Posts:
    112
    Also worked for me i.e. changed to Editor->UnityRemote->Device->None
     
  20. paiboonpa

    paiboonpa

    Joined:
    May 26, 2014
    Posts:
    6
    Confirmed with changed to Editor->UnityRemote->Device->None->Exit Unity (To save this config)->reopen->Fixed on Unity 5.3.1p3
     
    BillyMFT, sluice, ADNCG and 1 other person like this.
  21. Deleted User

    Deleted User

    Guest

    Let's form a consensus on this...I have narrowed it down to attaching my phone (IOS) through the editor. when I select the active phone, hit play.. crash...if I set device to none, save scene, close unity, open same scene again, go to editor, select my phone, hit play..it runs like it should..most of the time..

    So after 2 days,deleting my library (which..does not work).. I have come to this conclusion...for me..it is the 'state' of unity remote...in relation to the last state unity thinks the remote is in...when these two recorded 'states' do not match..unity throws an I/O error.(pings the phone, with no response)..the active data stream (input)..no longer matches the last/default state (active & pinging)....

    I can get IOS/iPhone 5 working with a certain combination of actions, on my part.

    1). Make sure my phone, still rotates the remote's logo, (is gyro still active?) - it freezes..
    2). Make sure my phone is in the orientation I set in the Player Settings.
    2)in the Unity editor, select none, for device..then switch back to iPhone.

    Save my scene & project....cross my fingers.

    hit play.

    (just on my IOS projects, Unity Remote 4 for IOS need to be updated, reflecting the latest OSX?)..been awhile


    Patrick-
     
    Last edited by a moderator: Jan 19, 2016
    marty, kayy and TheWarper like this.
  22. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    Fixed it for me. Thanks!
     
  23. Apoll0

    Apoll0

    Joined:
    Jun 11, 2015
    Posts:
    16
    Confirmed with changed to Editor->UnityRemote->Device->None->Exit Unity (To save this config)->reopen->Fixed on Unity 5.3.2f3
     
  24. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    I can confirm UnityRemote bing the problem too on my end.

    Thanks for the information!

    Jean
     
  25. sysameca

    sysameca

    Joined:
    Mar 2, 2013
    Posts:
    99
    5.3.3 and the issue is still there. Would it be possible somebody from Unity to take a look at this problem?
     
    TheWarper likes this.
  26. TheWarper

    TheWarper

    Joined:
    Nov 3, 2013
    Posts:
    112
    I 2nd that; this is really starting to drive me crazy.
     
  27. MikeCoderMore

    MikeCoderMore

    Joined:
    Sep 22, 2013
    Posts:
    61
    5.3.3 and the issue is still there for me too, no good :(

    Editor->UnityRemote->Device->None This also fixed it for me.
     
    Last edited: Mar 20, 2016
  28. TheWarper

    TheWarper

    Joined:
    Nov 3, 2013
    Posts:
    112
    5.3.4f1 and the issue is still there. Will we see a fix with the 5.4 HD release? *fingers crossed*
     
  29. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    Had the same error when importing Forge Networking. Device was already set to None. But setting it to Any Android Devices also fixed it. Sigh...

    I also lost all references in my components after the restart...
     
  30. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    This issue isn't getting fixed without bug reports I don't think... could someone be kind enough to throw a few up and leave numbers here for Unity staff to poke at?
     
    Deleted User likes this.
  31. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    280
    Thank you so SO much!!!!!
     
  32. yummybrainz

    yummybrainz

    Joined:
    Jan 14, 2014
    Posts:
    69
    I just got this error in the newest 5.5.0f3 release... I'm deleting my Temp and Library folders to see if re-import fixes it. Shame they still have not resolved this issue popping up randomly.
     
  33. PatientZero

    PatientZero

    Joined:
    Apr 8, 2015
    Posts:
    31
    Same Here
     
  34. lloydsummers

    lloydsummers

    Joined:
    May 17, 2013
    Posts:
    350
    Ditto here.5.5.0f3.

    I'm seeing random crash events with it too on scene loading, and crash events with too many lens flares and particle effects again too.

    Also, keep in mind, if you change anything in your apps/games in 5.5.053, it can't be downgraded to pre 5.5 like in previous builds, as they added a new serializable structure for .unity, .prefab and particle files.
     
  35. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Seeing this in 5.5.0f3 as well.
     
  36. msxh

    msxh

    Joined:
    Dec 19, 2016
    Posts:
    1
    Check for missing components or scripts in your scene.