Skip to main content

Posts

Showing posts from June, 2019

Save System for Unity - Technoob Technology

Unity API has a class called ‘PlayerPrefs’ which allows saving basic data types with a string key. But when a game becomes complex ‘PlayerPrefs’ can't save all the data and it's so hard to access them as you have to remember all the keys and call one by one. To avoid this we can create a custom save system which can save a class at once which contains all the data values. We need two scripts for this save-system.             01.SaveSystem class             02.SaveData class Save system class will contain all the methods to save and retrieve data and ‘SaveData’ class is used as the base class for the classes we going to create to store data.   ‘SaveData’ class doesn’t contain any methods and not extended by any other classes or interfaces. Make sure to mark this class as ‘[System.Serializable]’ in order to make sure this is serializable. [System.Serializable] public class SaveData { } ‘SaveSystem’ class contains 3 methods. One for