Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 ChoudharyPrince · Sep 28, 2021 at 04:08 AM · listloadsave data

hay i am new in saving and loading date in binary formate I wana to save and load list of data

I had a used json format to store data previously but it doesn't seems secured one as the data is stored in simpler form and easily editable by the player so i found this binarry formator on youtube which seems prity secured one but i was unable to fine how to store a list of data using that format. basicaly this is the class which i am using for couple of times with different character to store ther time, feed and sleep status. so basicaly i was using this class as an list in another class to store the values in this.

using UnityEngine;

[System.Serializable] public class PetDataHolder {

 public string closeTime = "00:00:00";
 public string timeLeft = "00:00:00";

 public int xp;

 public string feedTimerStore = "00:00:00";
 public string sleepTimerStore = "00:00:00";
 public string lockTimerStore = "00:00:00";

 [HideInInspector] public int Hr, Min,sec;
 [HideInInspector] public float Sec;

 [HideInInspector] public int feedHr, feedMin;
 [HideInInspector] public float feedSec;

 [HideInInspector] public int sleepHr, sleepMin;
 [HideInInspector] public float sleepSec;

 [HideInInspector] public int lockhr, lockMin;
 [HideInInspector] public float locksec;

 public int totalFeedToday;
 public int totalSleepToday;
 public int totalLockDownToday;
 public int days;

 [HideInInspector]public bool startFeed;
 [HideInInspector]public bool startSleep;
 [HideInInspector]public bool startLockDown;
 [HideInInspector]public bool petExhousted;

}

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rh_galaxy · Sep 28, 2021 at 02:15 PM

Why not use and convert your binary format to base64. It's harder to modify, and not possible to read like json and plain text. But you must face it, either go a full feature crypting enging or something, and do it with what you can. Right now this small approach should work.

 //save
 byte[] b = BitConverter.GetBytes(1024);
 System.Array.Copy(BitConverter.GetBytes(pd.xp), 0, b, iOffs + 0, 4);
 string base64 = System.Convert.ToBase64String(b);
 Debug.Log(base64.ToString());


 //load
 byte[] bytes = System.Convert.FromBase64String(szFileText);
 Debug.Log(szFileText);

(not completely sure of the code stuff but you will work it out).

Comment
Add comment · Share
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

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

129 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Save / Load List with Prefabs instantiated in the runtime 2 Answers

Save Load Data unity 0 Answers

Set int to object from list? 0 Answers

im getting a serialization exception eror in my load method 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