saving-data

Saving array using NSUserDefaults crashes app

倖福魔咒の 提交于 2019-12-01 14:40:27
I feel as if I am doing things correctly, but I am getting an error at the end of my data conversion and retrieval. Please see the code below: class Task:NSObject, NSCoding { var name:String var notes:String var date:NSDate var taskCompleted:Bool init(name:String, notes:String,date:NSDate, taskCompleted:Bool){ self.name = name self.notes = notes self.date = date self.taskCompleted = taskCompleted } required init(coder decoder: NSCoder){ self.name = (decoder.decodeObjectForKey("name") as! String?)! self.notes = (decoder.decodeObjectForKey("notes") as! String?)! self.date = (decoder

Best way to save data in Unity game [closed]

浪子不回头ぞ 提交于 2019-11-28 17:40:48
I was wondering... What's the best way to save data in Unity games. JSONs? If so, how? Thanks Short answer to your long question! Here are some of the different Ways and Methods to Save data for Unity Projects: Platform-Independent: One way of saving data in Unity3D in a Platform-independent way is to use the PlayerPrefs class. (Learn More 1 , 2 ). PERSISTENCE - SAVING AND LOADING DATA using DontDestroyOnLoad , PlayerPrefs , and data serialization Video Tutorial by unity . Server Side: You can also use a Server for saving data (like combination of PHP and MySQL Database). You can use it to