Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
0
Question by KIMHYUNJIN · May 17, 2016 at 04:23 AM · prefabwebplayerdictionaryserializedeserialize

webplayer serialize/deserialize error advice plz

Good morning. You are using a version unity3D5.3.3f1 underway webplayer based operations. Files can not be stored in the data processing and webplayer PlayerPrefs the data processing is possible only

public enum TEST_TYPE { None, Test_1 }

[Serializable] public class TestClass { public int nTestint = 0; public bool nTestbool = true;

} [Serializable] public class Test { public string testUser = "User"; public List listTest = new List(); public Dictionary dicTest = new Dictionary();

Test() {

} }

public static void Save() { BinaryFormatter bf = new BinaryFormatter(); MemoryStream memoryStream = new MemoryStream(); Test sTest = new Test (); bf.Serialize(memoryStream, Test); string tmp = System.Convert.ToBase64String(memoryStream.ToArray()); PlayerPrefs.SetString("TEST", tmp); }

public static void Load() { string tmp = PlayerPrefs.GetString("TEST", string.Empty); if (tmp == string.Empty) return; BinaryFormatter bf = new BinaryFormatter(); MemoryStream memoryStream = new MemoryStream(System.Convert.FromBase64String(tmp)); Test sTest = new Test (); Test = (Test)bf.Deserialize(memoryStream); }

Like the above Serialize / Deserialize the process by working. The unity is the normal data processing. The problem is in the process if you run Deserialize pulled build It causes the following aereo. List, and when annotating Dictionary will be processed. (Write current situation)

FieldAccessException: Attempt to access a private/protected field failed. at System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) [0x00000] in :0 at System.Runtime.Serialization.ObjectRecord.SetMemberValue (System.Runtime.Serialization.ObjectManager manager, System.Reflection.MemberInfo member, System.Object value) [0x00000] in :0 at System.Runtime.Serialization.FixupRecord.FixupImpl (System.Runtime.Serialization.ObjectManager manager) [0x00000] in :0 at System.Runtime.Serialization.BaseFixupRecord.DoFixup (System.Runtime.Serialization.ObjectManager manager, Boolean strict) [0x00000] in :0 at System.Runtime.Serialization.ObjectRecord.DoFixups (Boolean asContainer, System.Runtime.Serialization.ObjectManager manager, Boolean strict) [0x00000] in :0 at System.Runtime.Serialization.ObjectManager.RegisterObjectInternal (System.Object obj, System.Runtime.Serialization.ObjectRecord record) [0x00000] in :0 at System.Runtime.Serialization.ObjectManager.RegisterObject (System.Object obj, Int64 objectID, System.Runtime.Serialization.SerializationInfo info, Int64 idOfContainingObj, System.Reflection.MemberInfo member, System.Int32[] arrayIndex) [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject (Int64 objectId, System.Object objectInstance, System.Runtime.Serialization.SerializationInfo info, Int64 parentObjectId, System.Reflection.MemberInfo parentObjectMemeber, System.Int32[] indices) [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadValue (System.IO.BinaryReader reader, System.Object parentObject, Int64 parentObjectId, System.Runtime.Serialization.SerializationInfo info, System.Type valueType, System.String fieldName, System.Reflection.MemberInfo memberInfo, System.Int32[] indices) [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadGenericArray (System.IO.BinaryReader reader, System.Int64& objectId, System.Object& val) [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in :0

Reference mosterbank blog http://monsterbank.tistory.com/search/unity web

unity community http://answers.unity3d.com/questions/584269/webplayer-deserialization-fails.html

I saw how the information to be processed or the other side in the Web Play If you are interested, if you like solving minute advice, please, please.

Comment
Add comment
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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Transferring gameobjects between projects 0 Answers

Create an AssetBundle with prefabs containing imported models 0 Answers

Prefill list with AssetDatabase.LoadAssetAtPath 1 Answer

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

How to use SerializableDictionary in custom inspector? 0 Answers


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