Search Unity

Smooth Save for PlayMaker

Discussion in 'Assets and Asset Store' started by ChristopherCreates, Oct 18, 2015.

  1. ChristopherCreates

    ChristopherCreates

    Joined:
    Apr 8, 2015
    Posts:
    24
    Hi folks!

    I couldn't find a save game solution for PlayMaker that I was happy with, so I made my own.

    Introducing...



    Smooth Save is an easy and flexible save game solution for PlayMaker. You can save or load your whole game with a single action, or you can manage specific data in detail.

    Unity Asset Store: Smooth Save for PlayMaker

    By default, Smooth Save is almost magically easy to use. Just tell it to save, and it saves. Just tell it to load, and it loads. There are no keys to keep up with or other hoops to jump through. It just works. It’s that easy!

    But if you want more power, Smooth Save is ready for that, too. You can reference any variable by a unique key and you can save as many data pools as you need. You can save exactly what you want, exactly the way you want it.

    Smooth Save data is also cheat resistant. Instead of human readable and easily modified text files (XML, JSON, etc), it uses binary serialization. This prevents casual cheating by general users.

    Provided are 32 PlayMaker actions that go far beyond PlayerPrefs. There are actions for saving variables in bulk, individual actions for each type, data pool management, memory debugging, result events, and more.

    Smooth Save directly supports PlayMaker variables of type Bool, Color, Float, Int, Quaternion, Rect, String, Vector2, and Vector3. It also supports core GameObject properties, and can save most any other value in the game indirectly with the Get Property and Set Property actions.

    Smooth Save is the only save game asset built from the ground up specifically for PlayMaker. Don’t pay more for functionality you won’t or can’t use!

    Includes a demo scene and complete documentation. Download the documentation here.

    Requirements

    Smooth Save requires the PlayMaker asset, which is sold separately by Hutong Games.

    Smooth Save requires a writable file system to save data. As such, it does not support the Unity Web Player or other platforms which lack this.

    If you have any questions, just drop me a line.
    support@ChristopherCreates.com

    Unity Asset Store: Smooth Save for PlayMaker
     

    Attached Files:

    theANMATOR2b likes this.
  2. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    186
    I'd like to save an entire scene with the locations and states of all objects - do you have a tutorial that shows that?
     
  3. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    I got this up and running in a night, including building UI to manage it, all with PlayMaker. It works in the editor. However, it doesn't work on my desktop build (macOS). I believe upon attempting to load globals with a prefix filter, it goes to the Error state.

    Do I need to do something with PlayMaker to make the globals writable in the PlayerPrefs so that Smooth Save works on builds?

    Also, I am testing this hoping it also works on tvOS... But I haven't gotten that far yet-- just trying to get it to work in a macOS app first.
     
  4. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    PS: I just found in the documentation to enable Use PlayerPrefs before any other Smooth Save actions. I did this and got the following error in both the editor and the build:

    Cannot load data pool file. System error accessing file or file data corrupted: SmoothSave0000
    UnityEngine.Debug:LogError(Object)
    ChristopherCreates.SmoothSave.SmoothSaveDataPool:.ctor(Int32, Boolean) (at Assets/Smooth Save for PlayMaker/Scripts/SmoothSaveDataPool.cs:100)
    HutongGames.PlayMaker.Actions.SSBase:LoadDataPool(Int32, Boolean) (at Assets/Smooth Save for PlayMaker/Scripts/Actions/SSBase.cs:410)
    HutongGames.PlayMaker.Actions.SSLoadAll:OnEnter() (at Assets/Smooth Save for PlayMaker/Scripts/Actions/SSLoadAll.cs:24)
    HutongGames.PlayMaker.Actions.CopyPoolToGlobals:OnEnter() (at Assets/Smooth Save for PlayMaker/Scripts/Actions/CopyPoolToGlobals.cs:21)
    HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:201)
    HutongGames.PlayMaker.FsmState:OnEnter() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:169)
    HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2603)
    HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2561)
    HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2489)
    HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2619)
    HutongGames.PlayMaker.Fsm:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1865)
    PlayMakerFSM:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:509)

    It also looks like it's trying to find PlayMaker files relative to the creator's computer:
    c:/Users/Alex/Documents/Unity/Playmaker/Projects/

    ^^ That's not me.

    Also this:

    System.Xml.XmlException: Document element did not appear. Line 1, position 1.
    at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
    at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
    at System.Xml.XmlReader.MoveToContent () [0x00000] in <filename unknown>:0
    at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x00000] in <filename unknown>:0
    at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
    UnityEngine.Debug:LogError(Object)
    ChristopherCreates.SmoothSave.SmoothSaveDataPool:.ctor(Int32, Boolean) (at Assets/Smooth Save for PlayMaker/Scripts/SmoothSaveDataPool.cs:101)
    HutongGames.PlayMaker.Actions.SSBase:LoadDataPool(Int32, Boolean) (at Assets/Smooth Save for PlayMaker/Scripts/Actions/SSBase.cs:410)
    HutongGames.PlayMaker.Actions.SSLoadAll:OnEnter() (at Assets/Smooth Save for PlayMaker/Scripts/Actions/SSLoadAll.cs:24)
    HutongGames.PlayMaker.Actions.CopyPoolToGlobals:OnEnter() (at Assets/Smooth Save for PlayMaker/Scripts/Actions/CopyPoolToGlobals.cs:21)
    HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:201)
    HutongGames.PlayMaker.FsmState:OnEnter() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:169)
    HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2603)
    HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2561)
    HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2489)
    HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2619)
    HutongGames.PlayMaker.Fsm:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1865)
    PlayMakerFSM:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:509)


    Thoughts?
     
    theANMATOR2b likes this.
  5. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    Well I hunted down the Save file, deleted it-- still ran into the same problems. I switched back and forth between testing with Use PlayerPrefs and without. I got errors every time I used it. This has never worked in an actual build.

    Then, suddenly, a test build just worked, using the file system. When I tested again in editor using Use PlayerPrefs, it worked for the first time ever. But when I built this to macOS and tested that with Use PlayerPrefs, it failed to load the file... Isn't the whole point of using PlayerPrefs that it shouldn't even be looking for the file?

    What's even more alarming is how this was completely random. I essentially changed nothing I hadn't tried before, but this time it just decided to work in the editor and a build with the file system and in the editor with PlayerPrefs.

    Ultimately it still doesn't work because I need to use Player Prefs to support WebGL and tvOS, and no build has yet to work with Use PlayerPrefs on.

    Any advice?
     
    Last edited: Jun 8, 2017
    theANMATOR2b likes this.
  6. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    The dev has e-mailed me and we're going to try to sort this...
     
    theANMATOR2b likes this.
  7. Nabil_fx

    Nabil_fx

    Joined:
    Nov 9, 2013
    Posts:
    124
    do you find somewhere to show how to save the entire scene with the locations and states fsm?
     
  8. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    312
    j'aimerai savoir s'il y a une possibilité d'éditer mon fichier SmoothSave.sav ?
     
  9. ChristopherCreates

    ChristopherCreates

    Joined:
    Apr 8, 2015
    Posts:
    24
    Yes, but it requires some knowledge of C#. SmoothSave.sav is formatted with the standard binary serialization included with .Net. Check the source code for details.
     
  10. SawyerK

    SawyerK

    Joined:
    Feb 11, 2016
    Posts:
    55
    Hi!

    Smooth saving is amazing! Only problem i cant seem to figure out how to solve is the runtime initiated prefabs.
    I set a unique name for every prefab that is created runtime by adding a number at the end of the item's name

    when i press save game, It seem like it saves the gameobject array correctly


    But when i load the game, it load in only one for all of the gameobjects.


    I have run out of idea what to do here, they have a unique name so it should save it and load it.
    What could be the problem?

    Thank you.