how can i make a save feature in my game by pausing i want there to be a save game button then have them come back later and start from where they saved last
1 Answer
1Simple solution: Just store the index of the last played level and start from there when the player return. Use PlayerPrefs to store/read the level.
Advanced solution: If you want to return to the game exactly (well, nearly) the way it was before you left (missiles still flying around etc), then you need to put some serious effort in serializing every game object, every component and every value. You'd have to maintain the references and be able to reconstruct the scene to match just the state it was when you left it. It is a daunting task. I tried this once, and I did get it to work for one of our games but it led to messy code with several special cases that wasn't easy to deal with, and very hard to maintain. For example, not all components in Unity expose all the variables so you can't make an exact save, but you can make a "good enough" save.
Bought solution: There exists some sort of savegame manager on the unity assets store. I haven't tried it but if you want to make something slightly more sophisticated and don't want to put a lot of effort into it yourself you might want to look into it.
This may be able to help http://programmingtutorials.thinkific.com/courses/5-methods-to-saving-and-loading-your-game-data-in-unity3d If you use the coupon code SAVEME you get 50% off.
– savlon