• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by noahg1 · Mar 30, 2014 at 06:16 PM · c#load levelsave gameunityserializer

UnitySerializer not loading levels

Hi, I get the error below when I try and use LoadSavedLevelFromFile() and when I try and pass a string to LoadSavedLevel(). I know the string contains data because I always orint the sting to the console before calling and the text file is not empty. Could someone point me in the right direction to solving t$$anonymous$$s issue, I need it asap and I cannot seem to trace the issue.

 System.ArgumentNullException: Argument cannot be null.
 Parameter name: buffer
   at System.IO.MemoryStream..ctor (System.Byte[] buffer) [0x0000c] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/MemoryStream.cs:80 
   at (wrapper remoting-invoke-with-check) System.IO.MemoryStream:.ctor (byte[])
   at Serialization.UnitySerializer.Deserialize (System.Byte[] bytes) [0x0001d] in C:\Users\Noah\Documents\Paradox\Assets\Plugins\whydoidoit.com\Serialization\UnitySerializer.cs:1306 
   at Serialization.UnitySerializer.Deserialize[LevelData] (System.Byte[] array) [0x00017] in C:\Users\Noah\Documents\Paradox\Assets\Plugins\whydoidoit.com\Serialization\UnitySerializer.cs:642 
   at LevelSerializer.LoadSavedLevel (System.String data) [0x0002e] in C:\Users\Noah\Documents\Paradox\Assets\Plugins\whydoidoit.com\Serialization\LevelSerializer.cs:1175 
   at scriptUploadManagerv2.OnClick () [0x000a7] in C:\Users\Noah\Documents\Paradox\Assets\Levels\scriptUploadManagerv2.cs:69 
 UnityEngine.MonoBehaviour:print(Object)
 scriptUploadManagerv2:OnClick() (at Assets/Levels/scriptUploadManagerv2.cs:83)
 UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
 UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:821)
 UICamera:ProcessTouch(Boolean, Boolean) (at Assets/NGUI/Scripts/UI/UICamera.cs:1484)
 UICamera:ProcessMouse() (at Assets/NGUI/Scripts/UI/UICamera.cs:1109)
 UICamera:ProcessTouches() (at Assets/NGUI/Scripts/UI/UICamera.cs:1179)
 UICamera:Update() (at Assets/NGUI/Scripts/UI/UICamera.cs:969)



I am also recieving the following error when I try to use the example Pause menu script when I try and load a level

 NullReferenceException: Object reference not set to an instance of an object
 LevelLoader+<Load>c__Iterator8.<>m__C3 (UnityEngine.Component c) (at Assets/Plugins/whydoidoit.com/Serialization/LevelLoader.cs:250)
 System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[UnityEngine.Component].MoveNext ()
 System.Collections.Generic.List`1[UnityEngine.Component].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
 System.Collections.Generic.List`1[UnityEngine.Component]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
 System.Linq.Enumerable.ToList[Component] (IEnumerable`1 source)
 LevelLoader+<Load>c__Iterator8.MoveNext () (at Assets/Plugins/whydoidoit.com/Serialization/LevelLoader.cs:250)
 UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
 <PerformLoad>c__IteratorB:MoveNext() (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:1155)
 UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
 LevelSerializer:LoadNow(Object, Boolean, Boolean, Action`1) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:1150)
 LevelSerializer:LoadNow(Object) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:1106)
 PauseMenu:OnGUI() (at Assets/UnitySerializer/Scripts/PauseMenu.js:58)
Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Saving voxel terrain 2 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

List all saved games C# UnitySerializer 0 Answers

Make sure levels assets are loaded before switching? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges