ユニティでのゲームの進行状況を保存します


快来了

Share:

2 Comments

Add yours
  1. 1
    FWCorey

    BinaryFormatter is not really an ideal method for binary serialization. Custom binary serialization where each stored class has a GetBytes() method and a public MyClass(byte[] bytes) constructor can outperform all of these by orders of magnitude with extremely small file sizes. It’s a more advanced technique and requires a bit more planning, but it has the advantage of providing data that can be used with any C# Stream.

    In one project I’ve worked on a scene with 12000 logical tiles, that each had several attribute components and 8000 objects, also with varied attributes, placed on those tiles was serialized and uploaded to a server in less than 300ms or downloaded and deserialized in less than 600ms.

    Maybe expand the article to include a brief overview and tips for new programmers trying their hand at those techniques. They are no harder than using PlayerPrefs after all and only limited for a newbie to the types supported by BitConverter.

  2. 2
    Vasyl

    Thank you very much for this great atricle! I walked through this when I was creating save system for my current project. I wish I read it before 🙂 But I want to notice that you have a little of redundant code in here. You shouldn’t call Close() and Dispose() methods manually. At the end of the using block the Dispose method is automatically called which will take care to free unmanaged resources. As for the Close() method it calls Dispose().

+ Leave a Comment