Forum rules - please read before posting.

SerializationException problem

So I upgraded to unity 4.6.1 and now I'm getting this error:

SerializationException: serializationStream supports seeking, but its length is 0
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:155)
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:136)
AC.Serializer.DeserializeObjectBinary[OptionsData] (System.String pString) (at Assets/AdventureCreator/Scripts/Save system/Serializer.cs:110)
AC.SettingsManager.ShowGUI () (at Assets/AdventureCreator/Scripts/Managers/SettingsManager.cs:429)
AdventureCreator.OnGUI () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:138)
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-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

I'm using AC 1.40b

I get this problem when I click settings on the game editor.

Comments

  • edited December 2014
    And AC 1.40b was all find in 4.6.0?  What platform are you on?

    Thanks for the warning.  I'll update to 4.6.1 myself and see if this is a general issue.

    EDIT: Works fine for me.  I'll need to know more about your system.
  • I really don't know what the problem is, I think I fucked something up.

    I also updated unityVS to the latest version, I unninstalled 4.6.1, and installed 4.6 and the problem is still there (even with just an empty project and just AC), I deleted monodevelop, unityVS and unity altogheter, but after reinstalling the error keeps coming up.

    I'm now using unity 5 18b and it's working, I think I just dun goofed :(

    I can still use it in my laptop, unity 4.6.1

    Any ideas why it could be triggering the error ?
  • None at all, I'm afraid.  If it was working in 4.6 before, it does indeed sound like there's something wrong with your system.
  • BUMP

    I'm having the exact same problem with 4.6 when I click on the settings tab.

    Specs:

    Windows 7 Pro 64 SP1

    AMD FX-8350 4.0 GHZ 8-Core

    8 GB RAM

  • What Platform is set in your Build Settings?
  • Windows x86_64.
  • edited January 2015
    Since this is an issue on your machine, you'll have to bear with me a little.  Open up the script Serializer in AdventureCreator/Scripts/Save system.  Look for the following line around 97:

    public static T DeserializeObjectBinary <T> (string pString)

    Now insert the following just after the opening bracket on the next line:

    if (pString.Length == 0) return;

    Does that solve the issue?
  • I followed your directions on my machine, and the compiler sent this error:

    "Assets/AdventureCreator/Scripts/Save system/Serializer.cs(99,43): error CS0126: An object of a type convertible to `T' is required for the return statement"

  • Ah.  OK, try this instead:

    if (pString.Length == 0) return default (T);
  • Thanks for the reply. The console report:

    NullReferenceException: Object reference not set to an instance of an object
    AC.SettingsManager.ShowGUI () (at Assets/AdventureCreator/Scripts/Managers/SettingsManager.cs:520)
    AdventureCreator.OnGUI () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:138)
    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-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

  • edited January 2015
    OK.  Now we'll need to edit SettingsManager.cs.

    Line 518 reads:
    optionsData = Serializer.DeserializeObjectBinary  (optionsBinary);
    Replace it with the following:

    
    if (optionsBinary.Length > 0)
    {
      optionsData = Serializer.DeserializeObjectBinary  (optionsBinary);
    }
    else
    {
      optionsData = new OptionsData ();
    }
    
  • edited January 2015
    Same problem solved with last tip.
    Thanks Chris !!!
  • After a nervous click on the Settings tab, I had a feeling of relief as I saw it worked!

    Thanks Chris!

  • Glad to hear it!  I'll roll it out officially in 1.42.
  • I don't have the computer that was having problems right now, but suuuper glad this has been sorted out so I can use unity 4.6

    THANKs.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.