Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Unity's serialization system fails and causes the serialized data to be null

Discussion in 'Editor & General Support' started by agentc0re, Dec 29, 2016.

  1. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    Ever since I upgraded my project to 5.5.0.....I've ran into sooo many issues. Included is a output_log.txt file. You might look at the log and go, dummy just read what it says and fix it. Well thats the thing, these errors are WRONG. The datafiles for rewired is not missing or corrupt. The Avatar on MaleRoguePlayer is not missing... etc etc.

    I spoke with the Rewired dev and he suggested that Unity serialization system might be failing, but he'd have no idea and even suspected there might not be away to fix it.

    Yes I've un/reinstalled unity and the assets showing up as problems.

    I've submitted a bug report: (Case 865661). https://fogbugz.unity3d.com/default.asp?865661_58cpht5f3gq8vltq

    Please disregard the Kitten humor. :p

    Code (CSharp):
    1. Assertion failed on expression: 'value.byteStart + value.byteSize <= dataFileEnd'
    2.     UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    3.  
    4. Invalid serialized file header. File: "".
    5.     UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    6.  
    7. InvalidOperationException: Operation is not valid due to the current state of the object
    8.     System.Collections.Stack.Pop () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:329)
    9.     UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:290)
    10.     UnityEngine.GUILayout.EndVertical () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:317)
    11.     UnityEditor.EditorGUILayout.EndVertical () (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7230)
    12.     UnityEditor.EditorGUILayout.EndPlatformGrouping () (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7686)
    13.     UnityEditor.PlayerSettingsEditor.OnInspectorGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:456)
    14.     UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1227)
    15.     UnityEditor.DockArea:OnGUI()
    16.  
    17. InvalidOperationException: Operation is not valid due to the current state of the object
    18.     System.Collections.Stack.Pop () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:329)
    19.     UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:290)
    20.     UnityEngine.GUILayout.EndVertical () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:317)
    21.     UnityEditor.EditorGUILayout.EndVertical () (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7230)
    22.     UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1237)
    23.     UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1022)
    24.     UnityEditor.InspectorWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352)
    25.     System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    26.  
    27.  
    I get the above errors after building my game. If i build it in 32bit or 64bit it's a guarentee that I get these errors all the time.

    Code (CSharp):
    1. Assertion failed on expression: 'value.byteStart + value.byteSize <= dataFileEnd'
    2.     UnityEditor.HostView:OnGUI()
    3.  
    4. Invalid serialized file header. File: "".
    5.     UnityEditor.HostView:OnGUI()
    6.  
    7.  
    Im on Windows 10 64bit. Using Unity 5.5.0p3.

    When i first imported my project (because i've had to result to downloading a prior backed up version) Unity 5.5.0f3 erased at least 50% or more of my GO names. So frustrating!!! Aside from that, I also got the errors and more from what I showed up above.

    I ran a missing references script and OVER 100 assets in my collection were now MISSING script references, meshes, materials.. etc. etc.

    I really hope a Unity Team Member can offer me some assistance here. This is super frustrating to feel like all the work I put into my project so far is....just gone. :(

    **EDIT
    On top of all of this, besides the errors from running the game in the output_log.txt, everything now renders pink. I've try preloading shaders, selecting the shaders i use and then after 8+ hours of compile time unity finally crashes and tells me to submit a bug.... which I did.
     

    Attached Files:

    Last edited: Dec 29, 2016
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,600
    What version did you upgrade from?
     
  3. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    S***, I always leave something out. I upgraded from 5.4.3
     
  4. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    Oh yeah, another piece of information. If i create a brand new project, setup a simple scene using the assets that are failing on my actual project, the new scene works just fine. in editor and in build. So this has something ONLY to do with my one Project.
     
  5. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    967
    Start with the non-upgraded version of the project. Delete the Library folder. Open the project and let Unity rebuild Library. This will often, but not always, resolve odd upgrade issues.
     
  6. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    I've done that as well. Deleted all folders that can be regenerated by Unity. Still, same issues. Unless you're saying to go back to 5.4.3 and do that, then upgrade.
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,653
    I suggest you try reinstalling Rewired just to make sure none of the data has been corrupted in the upgrade. There's a known issue with Unity which can corrupt serialized strings when upgrading Unity, though that has different symptoms than this issue.

    Please do the following:
    1. Back up your project
    2. Close Unity if it's open
    3. Open your project
    4. Delete the Rewired folder
    5. Install Rewired from the Asset Store
    6. Close Unity
    7. Open Unity
    8. Open your project and test in the editor
    9. Test in a build
    In addition, make sure the Data Files field in your Rewired Input Manager inspector actually links to the ControllerDataFiles on disk in your project by clicking on the file linked in the object field.
     
    agentc0re likes this.
  8. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    One step a head of you boss. I tried that already. Build was still a bust.
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,653
    The other known issues with the serialization system, the only way to get it to work correctly was to reimport Rewired from the Unitypackage twice in a row without closing the editor. It's a long shot but you might try this.
     
    agentc0re likes this.
  10. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    So when I try to import twice, the second time prompts me that everything is already there and I hit okay. Thats it.

    I think the source of my issues is coming from a corrupt download of my restore.
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,653
    You could try building a different scene in the same project such as the Rewired/Examples/EightPlayers example and see if it also throws the same error.
     
    agentc0re likes this.
  12. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    Did that, great Idea actually! Build a simple version of my current scene and bam, it works, builds everything just fine. so that specific scene has a problem...
     
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,653
    Is the Rewired Input Manager a scene object or a prefab? Are you instantiating it from a script or does it exist in the scene from the beginning already?
     
  14. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    The "Rewired TPC Input Manager" is a prefab that I've dragged to the scene hierarchy. I just exists from the beginning.

    SO.,.. Update! asset bundles. a file in my data directory from after you build the game, "sharedassets0.assets", is 9GB!!! I actually stumbled across a thread finally when searching google because I've gotten the below errors EVERY time i build.

    Code (CSharp):
    1. Assertion failed on expression: 'value.byteStart + value.byteSize <= dataFileEnd'
    2.     UnityEditor.HostView:OnGUI()
    3.    
    4. Invalid serialized file header. File: "".
    5.     UnityEditor.HostView:OnGUI()
    Now what I found out is, that the file mentioned above cannot be larger than 4GB ever since the update where asset bundles became a thing. SO. I've found all the large directories under 4GB and have been making asset bundles of them. THIS will hopefully reduce that file size according to the post I found, which was commented on by someone at Unity suggesting the very thing. I'm working on doing this now and will report back once I find out if it fixes everything or not.
     
  15. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    Alright, I'm just too stupid to understand asset bundles... I guess I need to create some scripts for them to actually work, and they're really meant for external content that you'd download and cache. like DLC or something... i dunno thats the impression I got.

    Here's what I found after the build though:
    Textures 538.1 mb 7.1%
    Meshes 910.8 kb 0.0%
    Animations 7.2 mb 0.1%
    Sounds 47.0 kb 0.0%
    Shaders 1.7 mb 0.0%
    Other Assets 15.3 mb 0.2%
    Levels 86.5 mb 1.1%
    Scripts 8.7 mb 0.1%
    Included DLLs 5.2 mb 0.1%
    File headers 6952.0 mb 91.3%
    Complete size 7615.7 mb 100.0%

    File Headers is HUGE!!!! I need to find away to reduce this. Any idea's?
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,653
    I don't have an answer as to why the file headers would be so huge, but I suggest you might try deleting the Library folder in your project (with the editor closed). According to this page, it's always safe to delete the Library folder as it's just a cache. However, it can take a very long time to rebuild this folder after you've done it. I suggest backing up your project first regardless.
     
  17. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    I have deleted that folder before, But I did it again and nothing changed. :/ the build is still fubar.
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,653
    You could try deleting the Rewired TPC Input Manager and adding it back to the scene. You could also try reverting the prefab instance to its saved original using the button in the inspector.

    You could also try building in a new empty scene with only the Rewired TPC Input Manager instance added to the scene and see if you still get errors. This might tell you if it's the scene file or the prefab that's corrupted.

    Could you email me your prefab file (.asset) so I can check it out?
     
  19. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    Here's some stats!

    https://gyazo.com/1fa200d4f6a9270592888405f389b072
    Somehow I shaved off 2GB doing what I describe below. Thats cool. But it still needs to be less than 4GB according to unity docs.

    I rebuild the scene completely...sorta. I made prefabs of EVERYTHING in the scene that wasn't really working. Then I had to fix a bunch of stuff, like meshes not showing. Once i rebuilt everything that I had built in Mesh Baker, everything was back to it's original state. Compiled it, well....the camera is in the correct place now. Everything is still pink, but all shaders are set to standard or standard spec. I can see some particles move but it's just a bunch of pink boxes moving, I've never see that before.
    But in the end, still the same issue. :(
    ---
    To answer all your questions.
    1. I have deleted the Rewired TPC Input Manager and then adding it back. Made no difference at the time.
    2. I have done this too already. I made a very simple scene of my original scene and it built and ran just fine.
    3. I'm sorry but which prefab? I'm going to assume the rewired tpc input manager. But just in case, I thought I'd ask. :D
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,653
    Thanks for sending the files. I couldn't find anything wrong with the files themselves so I guess it's just a side effect of the larger upgrade data corruption issue.

    The only thing I have read that talks about a gigantic file header size has to do with having a ton of files in the Resources folder.

    I would try going back to your old backup before the 5.5 upgrade, make sure your editor settings are set to force text asset serialization and visible meta files, and then try the upgrade again and see if you get any different results. I find that force text tends to have fewer issues than force binary or auto. Data should never be corrupted when upgrading your project, but it does happen. In the past, I've re-done the upgrade and had no more issues.
     
  21. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    My back ups only are up to a month out. I go through backblaze to back up. I have restored the original & at it's original unity version of 5.4.3f3. Still, didn't work. I have zero files in my resources directory too. Im also on force text already.

    Also just wanted to let you know, thank you for all the help so far.
     
  22. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77