Search Unity

Save Game Pro - Gold Update

Discussion in 'Assets and Asset Store' started by hasanbayat, Nov 3, 2017.

  1. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    I'll be testing the encryption on these environments:
    • Unity 2017.1
    • Unity 2017.4
    • Unity 2018.1
    • Unity 2018.2
    • Unity 2018.3
    With both scripting runtime version, but if it didn't work with .NET 3.5, then I'll be using 4.x.
    Let me know if I'm missing something here.

    Thanks!
     
    Darkonen likes this.
  2. Darkonen

    Darkonen

    Joined:
    Nov 9, 2018
    Posts:
    8

    That seems great. You could take an update of the asset and we are testing it and here in the forum we are giving you opinion, you can also include the encryption in the description of the asset to improve it: D.
     
  3. Davide1104

    Davide1104

    Joined:
    Jun 12, 2013
    Posts:
    27
    I tried saving a list of gameobjects, and its working properly.
    The problem is when I load the list from the file, it also load all gameobjects in the scene.
    do you have any solutions?
    Thanks
     
  4. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Hi.
    That's normal behavior, as there should be a GameObject to load the data into it.
    By the way, you may need to use data wrappers or structures instead of saving GameObject, as you don't want to instantiate GameObjects while loading the data.
    So, I would suggest you take a look at our Article on Saving Data to Single File that gives you inspirations.

    Also, if you want you can use LoadInto instead of Load to load the data into the GameObjects of your choice instead of instantiating them.

    Hope this helps.
    Thanks.
     
  5. Davide1104

    Davide1104

    Joined:
    Jun 12, 2013
    Posts:
    27
    ok thankyou
     
  6. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    New Version submitted for Review, 2.8.0:
    • Introducing AES Encryption (The encryption settings can be adjusted using SaveGameSettings class)
    • Added a new Encryption example named "Saving Encrypted Data"
    • Fixed IndexOutOfRangeException when importing Save Game Pro to a project at the start (For more information check https://github.com/BayatGames/Support/issues/11)
    Note: The encryption has been tested on Unity 2017.1, 2017.4, 2018.1, 2018.2 and 2018.3 so if you ran into any issue and found any bug on different environments, we will release hotfixes as soon as possible.
    Thanks to the community for the feature requests and bug reports!
     
    Darkonen and keyonek1 like this.
  7. Darkonen

    Darkonen

    Joined:
    Nov 9, 2018
    Posts:
    8
    Thank you very much! How long will it take to be available in the asset store 24 hours?
     
  8. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    It depends, the Asset Store team will review it and then it will be available right after.
     
    Darkonen likes this.
  9. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    It is now live!
     
    Darkonen likes this.
  10. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
  11. munimraza

    munimraza

    Joined:
    Sep 23, 2017
    Posts:
    9
    I am facing an issue in Save Game v2.6.9 in Unity 2018.3.2f1 that when I save using
    SaveGame.Save(Application.persistentDataPath + "/userFiles/userdata" , classStateObject);
    it saves and files are created in that directory but when I read using
    classStateObject = SaveGame.Load(Application.persistentDataPath + "/userFiles/userdata");
    it returns null.
     
  12. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Hi, sorry for the late reply.
    As I have checked your code, you are loading the data without specifying the type, you should specify the type when loading data:
    classStateObject = SaveGame.Load<Your Type Here>(Application.persistentDataPath + "/userFiles/userdata");
    Or:
    classStateObject = SaveGame.Load(Application.persistentDataPath + "/userFiles/userdata", typeof(Your Type Here));

    Hope this helps.
    Thanks.
     
  13. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    New Version is out now, 2.8.4:
    • Fixed JsonFormatter serializing number bigger than the range of number type supports, such as a huge float type number which now uses Decimal in serialization and uses the specified type for deserialization
    • Added & Fixed Async/Await support to Firebase integration
    • Added & Fixed Async/Await support to Firebase PlayMaker integration
    • Now Firebase integration fully works with Unity 2018 and C# Async
    • Fixed Save Game Xbox Cloud Overload methods with missing parameter
    Thanks!
     
  14. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    What is the bes way to save inventory like this

    Code (CSharp):
    1. public class Inventory
    2. {
    3.     public List<Item> items;
    4. }
    5.  
    6. public abstract class Item
    7. {
    8.     public string name;
    9. }
    10.  
    11. public class Weapon : Item
    12. {
    13.     public int damage;
    14. }
    15.  
    16. public class Armor : Item
    17. {
    18.     public float defence;
    19. }
    I only came up with was to create the container class.

    Code (CSharp):
    1. public class Container
    2. {
    3.     public enum Index { Weapon, Armor }
    4.  
    5.     public Index index;
    6.     public string name;
    7.     public int damage;
    8.     public float defence;
    9.  
    10.     public Item GetItem() { ... }
    11. }
    I just think that Save Game Pro has an implementation of this capability.
     
    Last edited: Mar 6, 2019
  15. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Hi, yeah.
    Looks to be a problem with the reflection I have used in this Binary serialization.
    Currently, the BinaryFormatter which is used by Save Game Pro for serialization doesn't serialize Type information, while it should do it as for these cases we need to know what exactly is the type we have serialized.
    So, I'm going to create a V2 (Version 2) for BinaryFormatter which allows serializing such cases. (BinaryFormatterV2)
    This update will be available in the upcoming month.
    It will also include more features and improvements.
    Looking forward to your ideas and feedback.

    I hope you understand.
    Thanks.
     
  16. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    I see. Thanks for Your prompt reply. I will wait for the new version. In the meantime, I'll use the container class. With the container everything works stably and gives full control over what is happening.
     
    hasanbayat likes this.
  17. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    Is there any implementation of sync in FireBase and save locally (for the moment when save to FireBase is not available).
     
  18. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Firebase includes this feature for Android and iOS, I don't if it is implemented for Unity yet.
    You can check it out here Enable offline data.

    Thanks.
     
  19. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    Thank you very match.
     
  20. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    Has Save Game Pro got the ability to use Cloud Firestore of Firebase or only Realtime Database? Which one do you recommend?
     
  21. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    The Firebase Unity SDK does not support Cloud Firestore yet, you can check the supported services at Add Firebase to your Unity project:
    Firebase Unity SDK - Supported Services.png
    Thanks.
     
  22. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    Yeah, I already found that list. Thanks. I apologize for such silly questions.
     
  23. MagicK47

    MagicK47

    Joined:
    Sep 5, 2017
    Posts:
    16
    Failed to read past end of stream.
    This error occurred while loading
     
  24. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Hi.
    I didn't reply sooner cause I thought you may attach some more information.
    Can you please explain what you did and when did it happen?

    Thanks.
    Regards.
     
  25. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    Can you help? What is the difference between list = Load<List>() and LoadInto(list). I mean, LoadInto doesn't work in all cases. And another one. Should I wait for firebase to finish saving. Or I can call saving with the same identifier.

    For example, there is the method in the class

    Code (CSharp):
    1. protected override async Task CloudSaveAsync()
    2. {
    3.     Debug.LogFormat("Start cloud saving {0}", identifier);
    4.     SaveGameFirebase firebase = GetFirebase();
    5.  
    6.     try
    7.     {
    8.         await firebase.SaveAsync(identifier, scenarios);
    9.         Debug.LogFormat("{0} cloud save complete", identifier);
    10.     }
    11.     catch
    12.     {
    13.         Debug.LogFormat("{0} cloud save error.", identifier);
    14.     }
    15. }
    If I call this method twice in a row, I get
    Start cloud saving...
    Start cloud saving...
    ..cloud save complete

    2 - start and 1 - complete. Is it not a problem? Or I do something wrong?
     
  26. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Hi.
    Load method creates a new object instance and loads the data to it, so when it is a collection type it loops through the count of collection entities and instantiates them accordingly.
    LoadInto method tries to load data to an existing object or instantiates a new object when needed or the collection doesn't contain any object at the specified index.
    For example, when I have a List which contains a reference to scene objects, and I want to save their properties and load them back without instantiating new obejcts, I can use LoadInto<List<GameObject>>.

    For Firebase, when you call the save method twice or more, it just creates a new call to the server, which is not a problem, but I would suggest you to do it in Async, not in parallel which may cause some issues with internal Firebase implementation, but there is no problem with that on Save Game Pro integration side.

    Thanks.
    Best Regards.
     
  27. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    What does "to do it in Async, not in parallel" mean? How do it parallel without async? Or I just don't understend what parallel is.
     
  28. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Parallel means doing the multiple saving action at the same time ,for example doing this:
    Code (CSharp):
    1. SaveAsync(myValue)
    2. SaveAsync(myValue2)
    But, Async I meant to do one by one like this:
    Code (CSharp):
    1. await SaveAsync(myValue)
    2. await SaveAsync(myValue);
    And so on.

    Hope this helps.
     
  29. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    It was my first question. I have method CloudSaveAsync(). It can be called from different places of the program at any time. Including at the same time. The code I cited above. The save call can start before the previous save ends.
     
  30. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    It should work fine then.
     
  31. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    Thank you!
     
  32. Holygoe

    Holygoe

    Joined:
    Mar 3, 2015
    Posts:
    11
    It is not a problem, but in Unity menu "Windows -> Save Game Pro -> About" incorrect version is displayed.
     
  33. benjaminthorn

    benjaminthorn

    Joined:
    Mar 9, 2018
    Posts:
    19
    Hi, I get lots of errors from save game gold when importing Bolt. Any Idea?
     

    Attached Files:

  34. MagicK47

    MagicK47

    Joined:
    Sep 5, 2017
    Posts:
    16
    Why did I save without an error and load with an error

    NullReferenceException
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoProperty.cs:331)
    System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/PropertyInfo.cs:102)
    BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.ReadSavableMembers (System.Object obj, System.Type type) (at Assets/Import/BayatGames/SaveGamePro/Scripts/Serialization/Formatters/Binary/BinaryObjectReader.cs:952)
    BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.ReadObject (System.Type type, System.Object result) (at Assets/Import/BayatGames/SaveGamePro/Scripts/Serialization/Formatters/Binary/BinaryObjectReader.cs:860)
    BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.ReadObject (System.Type type) (at Assets/Import/BayatGames/SaveGamePro/Scripts/Serialization/Formatters/Binary/BinaryObjectReader.cs:818)
    BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.Read (System.Type type) (at Assets/Import/BayatGames/SaveGamePro/Scripts/Serialization/Formatters/Binary/BinaryObjectReader.cs:434)
    BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.Read (System.Type type) (at Assets/Import/BayatGames/SaveGamePro/Scripts/Serialization/Formatters/Binary/BinaryObjectReader.cs:338)
    BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream input, System.Type type, SaveGameSettings settings) (at Assets/Import/BayatGames/SaveGamePro/Scripts/Serialization/Formatters/Binary/BinaryFormatter.cs:182)
    BayatGames.SaveGamePro.SaveGame.Load (System.String identifier, System.Type type, System.Object defaultValue, SaveGameSettings settings) (at Assets/Import/BayatGames/SaveGamePro/Scripts/SaveGame.cs:549)
    BayatGames.SaveGamePro.SaveGame.Load[List`1] (System.String identifier) (at Assets/Import/BayatGames/SaveGamePro/Scripts/SaveGame.cs:361)
    PlayerGameDataSaveLoadM.LoadSceneData () (at Assets/Game/War/Script/PlayerGameDataSaveLoadM.cs:216)
     

    Attached Files:

  35. MagicK47

    MagicK47

    Joined:
    Sep 5, 2017
    Posts:
    16
    Even if I just saved a simple class, I would still report an error, which is too buggy
     
  36. MagicK47

    MagicK47

    Joined:
    Sep 5, 2017
    Posts:
    16
    Even if I just saved a simple class, I would still report an error, which is too buggy???
     

    Attached Files:

  37. matteumayo

    matteumayo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Hello,

    I'm having trouble figuring out how to save a multi-dimensional array of a custom type ("Tile" in my case.)

    I've added the type and edited with Read and ReadInto and such as per the custom type page in the documentation, but when trying to save my Tile[,] array in the same way as shown in the SaveCollections example, I get the warning:

    SaveGamePro: The serialization of type Tile[,] isn't supported.

    Previous to this, I had been trying to save the Tile[,] 2D array inside of a data wrapper class, but I couldn't get that to work. (It is a simple WorldData class that just has a string, ints, and the Tile[,] 2D array. It saved fine without warning, but I couldn't get anywhere trying to load it.)

    So, is it possible to save and load multi-dimensional arrays of custom types with this asset? If so could you give an example of how this could work?

    Thanks.

    SaveGameType_Tile.cs: https://pastebin.com/b99izPft

    SaveGameType_WorldData.cs: https://pastebin.com/9djzGty7
     
    Last edited: Mar 27, 2019
  38. Davlin

    Davlin

    Joined:
    Feb 19, 2013
    Posts:
    54
    Hello

    ☀️ Xbox Connected Storage Integration
    Could you please tell does it support id@xbox Connected Storage or only Creators Program?
     
  39. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Hi, sorry for the late reply, I miss these forum emails within a bunch of other emails, by the way, I reply to Direct emails nearly instantly.
    That error is common, that means there is a System.Threading.Task already defined.
    Please check out this Thread on Bolt Forum: System.Threading does not work with .NET 4.6

    I'm currently activly working on the new update of Save Game Pro which introduces a Reference Manager that allows saving and loading Scene objects, prefabs and other asset objects such as ScriptableObjects with ease.
    But for now, you may need to use non-monobehaviour classes for saving and loading, or mark the reference fields as NonSavable.

    But it should work fine with any other data class, or a simple class, just check out the working examples.

    Can you send your Tile and WorldData scripts?
    Also, does Tile or WorldData are extending MonoBehaviour?
    There is no problem with saving and loading multi-dimensional arrays, but there are some issues in saving UnityEngine.Object types, which will be fixed with the new update and reference manager.

    I think I replied to your question in email or facebook I guess, by the way, it works with both of those programs, there is no difference between the API.

    Hope this helps.
    Thanks.
     
  40. LuizBeenoculus

    LuizBeenoculus

    Joined:
    May 17, 2018
    Posts:
    5
    Hello guys! Im having this error, when I triyng to load my data: "Access to the path 'C:\Users\luizt\AppData\LocalLow\Beenoculus\Classroom\classrooms' is denied."

    Code (CSharp):
    1. UnauthorizedAccessException: Access to the path 'C:\Users\luizt\AppData\LocalLow\Beenoculus\Classroom\classrooms' is denied.
    2. System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    3. System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    4. (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    5. System.IO.File.OpenRead (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
    6. BayatGames.SaveGameFree.SaveGame.Load[T] (System.String identifier, T defaultValue, System.Boolean encode, System.String password, BayatGames.SaveGameFree.Serializers.ISaveGameSerializer serializer, BayatGames.SaveGameFree.Encoders.ISaveGameEncoder encoder, System.Text.Encoding encoding, BayatGames.SaveGameFree.SaveGamePath path) (at Assets/BayatGames/SaveGameFree/Scripts/SaveGame.cs:662)
    7. BayatGames.SaveGameFree.SaveGame.Load[T] (System.String identifier) (at Assets/BayatGames/SaveGameFree/Scripts/SaveGame.cs:428)
    8. ClassroomsManager.LoadClassrooms () (at Assets/_scripts/Classrooms/ClassroomsManager.cs:48)
    9. ClassroomsManager.Awake () (at Assets/_scripts/Classrooms/ClassroomsManager
     
  41. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Hi.
    There are many causes for that error:
    • You may have a directory named same as classrooms
    • You may have wrong permissions for the directory you're trying to save
    • Maybe the parent directory is not created
    Maybe try adding a file extension or check the folder by yourself to see if the directory or file is being created successfully, or check the permissions if you haven't changed it before.
    But I think that would be that directory named same as file issue.

    Hope this helps.
    Thanks.
     
  42. hanguny

    hanguny

    Joined:
    Jun 21, 2013
    Posts:
    1
    This is cool!
    When are you going to support for Nintendo Switch?
    I need it.
     
  43. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Hi.
    It is on our planned integrations list, by the way, we will some help on it from a partner which provides Nintendo Switch dev kit which allows us to provide native integration.
     
  44. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    170
    The playmaker action "Save Game Clear" seems to do nothing, Also how do you use Save Game Save Globals and Save Game Load Globals? There are no options and I cant find anything in the manual on them
     
  45. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    Save Game Save Globals and Save Game Load Globals save/load all the global variables defined in the FSM.
    Also, how did you make sure that Save Game Clear is not working? Can you explain in depth? I would be happy to help in that case.

    Thanks.
     
  46. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    170
    I was able to figure out how clear work through trial and error, however, the save and load actions still have me perplexed. So does it load/save all global variables ONLY for a specific FSM or throughout all FSM's? Is there a way to have some kind of array or group of global variables to be saved and then later loaded? As it is, if I'm understanding this correctly, I have to create a variable for each and everything I want to be saved within in a game and then manually have each one of these load one by one instead of by the group. Could be daunting if there are hundreds of things in a scene/game that need to be saved/loaded.
     
  47. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    170
    Is there a page in the documentation that explains how each of these actions work? I can't find anything that explains this in any detail?
     
  48. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    The save / load globals actions saves the variables defined at this window:
    Annotation 2019-07-12 111209.png
    By the way, if you want to save multiple variables at once with a single call, you can do it like so:
    Annotation 2019-07-12 111528.png
    By increasing the count, you can save multiple values at the same time.
    So if you want to do grouping, I would suggest you to have a list of variables you want to save, that's how actually grouping works, anyway I would be happy to hear your ideas on this though.

    Thanks!
     
  49. rexcheung

    rexcheung

    Joined:
    Feb 2, 2017
    Posts:
    27
    I just brought this asset. It is great~
    I have a problem regarding cloud save - web.
    I am going to save it to a php based web site with mysql. The website has backend to read data out and display in website, instead of inside unity. I need to know the format of the data_value.
    This "data_value" filed is under "saves" table in mysql.
    I guess the value in this field should be "Base64", right?
    Also, i found that it always has " " (i.e. two space as prefix, right?).

    For example, i save "abc" in unity, the corresponding "data_value" in mysql is "AQNhYmM=",
    "AQNhYmM=" is " abc" in ASCII text.
    (Remark - i investigate the conversion at this website - https://www.rapidtables.com/convert/number/ascii-hex-bin-dec-converter.html )
     
  50. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    548
    You needs to change the serialization format to JSON and then when you want to display the data, convert it from Base64 to normal text, that's the process.

    Hope this helps.
    Thanks.