Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Save Game Pro - Gold Update

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

  1. rexcheung

    rexcheung

    Joined:
    Feb 2, 2017
    Posts:
    35
    Thanks for your prompt reply.
    I added below on "WebCloudSave.cs" in Cloud Save - Web scene.
    //--------------------------------
    public void start() {
    SaveGameSettings settings = SaveGame.DefaultSettings;
    settings.Formatter = new BayatGames.SaveGamePro.Serialization.Formatters.Json.JsonFormatter();
    SaveGame.DefaultSettings = settings;
    Save();
    }
    //--------------------------------
    But the value at mysql is the same. Did i change the serialization format to JSON successfully?
     
  2. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Yes, you did, and the data in your MySQL is base64 format, so if you want to display it, just decode it with base64_decode in php or any other language.
     
  3. rexcheung

    rexcheung

    Joined:
    Feb 2, 2017
    Posts:
    35
    HI,

    Do you have worked example on how to read out the data from mysql on php?
    I believed you encoded the data at unity with some header when save in mysql.
    My problem now is: after data operation, i write those data back to mysql, however, unity cannot read it with correct values as i did not include the header.

    For example,
    in unity: 10.1.2.3.4 -> AQoxMC4xLjIuMy40.

    Thanks.
     
  4. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Unfortunately I don't have a working example showcase that.
    If you use JSON format and then upload the data to database and then decode it with base64, it should work fine, and there is no header.
    I think you have used Binary format for that number "AQoxMC4xLjIuMy40", but with JSON it should be fine.

    Thanks.
     
  5. rexcheung

    rexcheung

    Joined:
    Feb 2, 2017
    Posts:
    35
    Could you please help to tell me how could i check if i changed my setting to be JSON.
     
  6. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    You already did that with changing default settings like so:
    Code (CSharp):
    1. SaveGameSettings settings = SaveGame.DefaultSettings;
    2. settings.Formatter = new BayatGames.SaveGamePro.Serialization.Formatters.Json.JsonFormatter();
    3. SaveGame.DefaultSettings = settings;
    And when the data is stored on your database, just use a base64 decoder to check if the data is in JSON format then you can use base64 decode ot display data anywhere.
     
  7. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
  8. Pandur1982

    Pandur1982

    Joined:
    Jun 16, 2015
    Posts:
    275
    Hello i have a question, work that save game asset with inventory pro and have it a Integration for it?
     
  9. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Hello.
    Unfortunately there is no integration for Inventory Pro yet, but I think it is pretty simple and easy to make an integration.
    So, I've made an integration now, please try it and let know how it goes.
    These 2 scripts work like PlayerPrefsCollectionSaverLoader and PlayerPrefsContainerSaverLoader, so the installation concept is same.

    Thanks.
     

    Attached Files:

  10. Pandur1982

    Pandur1982

    Joined:
    Jun 16, 2015
    Posts:
    275
    thx for your fast answer, when i back at home on Monday i will test it out.
     
  11. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    158
    Hi, I'm having the following problem, I have some prefab variants that I save being used in a system for character selection, the thing is that when I load the Transform I receive it empty. Can Save Game Pro save prefabs and prefab variants?

    thanks.
     
  12. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Hello.
    Unfortunately, no we didn't add support for saving and loading prefab and new prefab system as well yet.
    You might need to save these information through data models and other available ways instead of saving the whole prefab.
    There are a few methods to do so which is provided in the below article:

    Thanks.
     
    TJBRB likes this.
  13. Nayton

    Nayton

    Joined:
    Dec 27, 2019
    Posts:
    1
    How much the last version???
     
  14. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    It is €17.86 in Euro and is $19.99 in USD, how much does it write for you there?
     
  15. IceLab_Game

    IceLab_Game

    Joined:
    Dec 18, 2015
    Posts:
    17
    good morning
    i need help, i am creating a simple quest system
    I need to load active quests into an array with the load command
    I'm trying this way but it doesn't work, can you give me some advice?

    Quests[] quests = (Quests[])SaveGame.Load<Quests>(typeof(Quests[]);


    also I could use to load in arrays, saves by name,
    example quest_collect*
    can I filter load by a part of name?


    edit: I just need to know how to load all the Quests saves regardless of the name, is it possible?

    thanks
     
    Last edited: Jan 2, 2020
  16. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Hello.
    May I ask you to provide more details on why it doesn't work or any error messages?

    Save Game Pro doesn't support polymorphic serialization so you've to use a reference based system with IDs instead, like you can have a Quest database which holds a dictionary of Quest IDs and the Quests, then when you load the specific quest id with its data you assign it to the given quest inside the quest database.

    And for the filter load, do you mean loading files matching a specific pattern?

    Thanks.
     
  17. IceLab_Game

    IceLab_Game

    Joined:
    Dec 18, 2015
    Posts:
    17


    thanks for your answer
    Exactly you immediately understood the problem, I'm using an Id system, but I don't want to use a database because I'm afraid of compatibility problems on different platforms

    example

    SaveGame.Save <Quests> ("quest" + questUpdate.id, questUpdate);

    I'm thinking of creating an array with all the ids active, so as to loop all the active quests

    I only need this, I don't have to do anything complex
     
  18. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Well you have a problem in your code, you should specify the Array type inside the type argument of Save and Load methods as well, like this:
    Code (CSharp):
    1. Quests[] quests = (Quests[])SaveGame.Load<Quests[]>(typeof(Quests[]);
    This piece matters:
    Code (CSharp):
    1. SaveGame.Load<Quests[]>
    And same for save if you're specifying a Type argument:
    Code (CSharp):
    1. SaveGame.Save<Quests[]>
     
  19. IceLab_Game

    IceLab_Game

    Joined:
    Dec 18, 2015
    Posts:
    17

    ok thanks

    Quests[] quests = (Quests[])SaveGame.Load<Quests[]>(typeof(Quests[]));

    this command have error
    want a mandatory string, is it possible to avoid and use only the type?
    without a name
    if I solve this I'm done
     
  20. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    The identifier is a mandatory argument.
    You can use something like "quests.dat" or anything else.
     
  21. livium

    livium

    Joined:
    Aug 3, 2018
    Posts:
    27
    Hi,

    I update to last version and I get this error:

    CryptographicException: Bad PKCS7 padding. Invalid length 0.
    Mono.Security.Cryptography.SymmetricTransform.ThrowBadPaddingException (System.Security.Cryptography.PaddingMode padding, System.Int32 length, System.Int32 position) (at <567df3e0919241ba98db88bec4c6696f>:0)
    Mono.Security.Cryptography.SymmetricTransform.FinalDecrypt (System.Byte[] inputBuffer, System.Int32 inputOffset, System.Int32 inputCount) (at <567df3e0919241ba98db88bec4c6696f>:0)
    Mono.Security.Cryptography.SymmetricTransform.TransformFinalBlock (System.Byte[] inputBuffer, System.Int32 inputOffset, System.Int32 inputCount) (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.Security.Cryptography.CryptoStream.FlushFinalBlock () (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.Security.Cryptography.CryptoStream.Dispose (System.Boolean disposing) (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.IO.Stream.Close () (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.IO.Stream.Dispose () (at <567df3e0919241ba98db88bec4c6696f>:0)
    BayatGames.SaveGamePro.SaveGame.Load (System.String identifier, System.Type type, System.Object defaultValue, BayatGames.SaveGamePro.SaveGameSettings settings) (at Assets/BayatGames/SaveGamePro/Scripts/SaveGame.cs:628)
    BayatGames.SaveGamePro.SaveGame.Load[T] (System.String identifier, T defaultValue) (at Assets/BayatGames/SaveGamePro/Scripts/SaveGame.cs:483)
     
  22. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Well, we've sorted out this issue on Discord server though.
    Just pointing out here for further readers.
     
  23. muhammad445

    muhammad445

    Joined:
    Dec 2, 2019
    Posts:
    1
    Hello, I am wondering if this system is good for making a semi-online game? I am looking to save and load data in near real time without much SQL knowledge. Will this be a good solution? If so, do you have an recommendations on which cloud system I should use or if I should host my own database.

    Thanks!
     
  24. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    New Version out now, 2.9.5:
    • Added "SGP_FORCE_MANUAL_TYPES" Scripting Define Symbol which forces SaveGameTypeManager to use Manual AddType instead of Reflection based type
    • Updated Examples with more detailed description and details with instructions.
    • Added EncryptionUtils for migrating existing data, for example Encrypting currently unencrypted data or Decrypted currently encrypted data.
    • Introducing Meta Data, which allows storing additional information about an Entity, such as "Encrypted" which specifies whether this entity is encrypted or not, or whatever, you can also add your own meta information to it by using MetaDataUtils API, we're working on this to improve, please consider it in Beta version.
    • Added MetaDataUtils for managing MetaData entities.
    • Added SaveRaw and LoadRaw methods for saving and loading raw data (binary or byte array)
    • Introducing BinaryFormatterV2 Alpha version.
    • Fixed PlayMaker Integration Array Saving/Loading issues
    • Fixed minor bugs for ReadInto method
    • Fixed & Updated Casting of Array Values (For 4 actions, GetIntArray, GetStringArray, GetBoolArray, GetFloatArray)
    • Fixed various bugs
     
  25. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Hello, just pointing it out here that we've got the conversation on Discord, so let's continue there.
     
  26. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    Good morning. After last update when try to Load any data saved with encryption i take this error:

    "System.IO.EndOfStreamException: Unable to read beyond the end of the stream.\r\n at System.IO.__Error.EndOfFile () [0x0000a] in <567df3e0919241ba98db88bec4c6696f>:0 \r\n at System.IO.BinaryReader.ReadString () [0x000a2] in <567df3e0919241ba98db88bec4c6696f>:0 \r\n at BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.ReadSavableMembers (System.Object obj, System.Type type) [0x00012] in D:\\Progetti Unity\\Hyper Burst\\Assets\\UnyX\\Plugins\\BayatGames\\SaveGamePro\\Scripts\\Serialization\\Formatters\\Binary\\BinaryObjectReader.cs:952 \r\n at BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.ReadObject (System.Type type, System.Object result) [0x000de] in D:\\Progetti Unity\\Hyper Burst\\Assets\\UnyX\\Plugins\\BayatGames\\SaveGamePro\\Scripts\\Serialization\\Formatters\\Binary\\BinaryObjectReader.cs:869 \r\n at BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.ReadObject (System.Type type) [0x00037] in D:\\Progetti Unity\\Hyper Burst\\Assets\\UnyX\\Plugins\\BayatGames\\SaveGamePro\\Scripts\\Serialization\\Formatters\\Binary\\BinaryObjectReader.cs:827 \r\n at BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryObjectReader.Read (System.Type type) [0x00bd6] in D:\\Progetti Unity\\Hyper Burst\\Assets\\UnyX\\Plugins\\BayatGames\\SaveGamePro\\Scripts\\Serialization\\Formatters\\Binary\\BinaryObjectReader.cs:434 \r\n at BayatGames.SaveGamePro.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream input, System.Type type, BayatGames.SaveGamePro.SaveGameSettings settings) [0x00013] in D:\\Progetti Unity\\Hyper Burst\\Assets\\UnyX\\Plugins\\BayatGames\\SaveGamePro\\Scripts\\Serialization\\Formatters\\Binary\\BinaryFormatter.cs:182 \r\n at BayatGames.SaveGamePro.SaveGame.Load (System.String identifier, System.Type type, System.Object defaultValue, BayatGames.SaveGamePro.SaveGameSettings settings) [0x0018b] in D:\\Progetti Unity\\Hyper Burst\\Assets\\UnyX\\Plugins\\BayatGames\\SaveGamePro\\Scripts\\SaveGame.cs:631 \r\n at BayatGames.SaveGamePro.SaveGame.Load[T] ... "

    I tried to delete the save files from the menu in the editor but it keeps giving me this error.
    Please solve this problem because I can no longer load the data

    also, after catch tihs exception when try to Delete e re-create the file on Delete method see this error in Unity Editor:

    IOException: Sharing violation on path C:/Users/Utente/AppData/LocalLow/Awakening/Hyper Burst\score_data
    System.IO.File.Delete (System.String path) (at <567df3e0919241ba98db88bec4c6696f>:0)
    BayatGames.SaveGamePro.IO.SaveGameFileStorage.Delete (BayatGames.SaveGamePro.SaveGameSettings settings) (at Assets/UnyX/Plugins/BayatGames/SaveGamePro/Scripts/IO/SaveGameFileStorage.cs:142)
    BayatGames.SaveGamePro.SaveGame.Delete (System.String identifier, BayatGames.SaveGamePro.SaveGameSettings settings) (at Assets/UnyX/Plugins/BayatGames/SaveGamePro/Scripts/SaveGame.cs:907)
    UnyX.Services.GameSavedService`1[T].Load () (at Assets/UnyX/Services/GameSavedService.cs:139)
    UnyX.Services.GameSavedService`1+<Awake>d__18[T].MoveNext () (at Assets/UnyX/Services/GameSavedService.cs:52)
    --- End of stack trace from previous location where exception was thrown ---
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <567df3e0919241ba98db88bec4c6696f>:0)
    UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at C:/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:150)
    UnityEngine.UnitySynchronizationContext:ExecuteTasks() (at C:/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:104)

    What happens in the last version? :(
     
  27. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Just pointing it out here that the conversation is moved on email.
     
  28. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    How is Save Game Pro for multi-scene games? If I wanted to store a) the currently loaded scenes and b) the state of those scenes, does SGP allow for this?
     
  29. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    It is possible but it would be hard to achieve that using Save Game Pro, I'd suggest you take a look at the new Save System which makes it easy to do what you're looking for much simpler and easier.

    Thanks.
     
  30. livium

    livium

    Joined:
    Aug 3, 2018
    Posts:
    27
    what is the difference between Save System and Save Game Pro? I already have Save Game Pro.
     
  31. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Thanks for the question.
    The Bayat - Save System is a new superior save system to Save Game Pro in all aspects which are made from ground-up, you can learn more about it at bayat.io/save-system.
    Here are a few key differences between the Save System and Save Game Pro:
    • The save system allows saving and loading objects by reference using its Asset Reference Resolver and Scene Reference Resolver
    • The save system provides extra functionalities on the storage such as Backup, Metadata, and Catalog
    • The save system allows serialization of all types of data, from Unity objects to C# objects
    • The save system handles circular references
    • Provides serialization attributes for controlling serialization behavior
    • And many more ...
    You can Migrate your Save Game Pro data to the new system but I'd suggest you use the new system for your new projects instead and if you're using Save Game Pro with your existing project which is published and being used by your users, there is no need to move to the new system unless you really need the features.

    Also, there is a 50% off for Save Game Pro owners and 50% as launch sale which will expire after 2 months.
     
    Last edited: Feb 12, 2020
  32. livium

    livium

    Joined:
    Aug 3, 2018
    Posts:
    27
    Tks for the explanation. I just purchase the Save System now for my future projects.
     
    hasanbayat likes this.
  33. maksymr

    maksymr

    Joined:
    Jan 31, 2015
    Posts:
    9
    Hey I own Save Game Pro and wanted to used it in my current project. I wonder if I can do async saving because regular saving freezes the game a bit. I'm keen on buying the new system but I need to know which one is better for Asynchronous data and do I really need the new one. Also If the price is upload_2020-2-25_16-45-25.png

    Do I still get previously mentioned discount as a Save Game Pro owner?

    Thanks for the answers.
     
  34. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Hello.
    Thanks for the question ❤️
    Both tools support Async save and load, but the new system is fully Async based and provides more flexibility and features than Save Game Pro, check Save Game Pro Async Save & Load article.

    By the way, multi-threading with serialization is not possible in Unity totally if you're serializing Unity objects, because the data (properties or fields) of Unity objects can't be accessed from any other thread than Main thread, so the possible solution would be to save the chunk based maybe or somehow optimize the data.

    And yes, you'll get the discount as you already see in the picture.

    Hope this helps.
    Regards.
     
  35. maksymr

    maksymr

    Joined:
    Jan 31, 2015
    Posts:
    9

    Thank you for the reply.

    I went through some examples of Save System and definitely looks promising but for the current project I'll probably stay with the previous version. I also tried to use this Async example but I get some errors and if you say as I understand it doesn't really matter because it relies on main thread then I'll stick to the regular way.

    What's the proper amount of data I can save without framedrops? Or is it possible I get such drop only in Unity Editor?
    Let's say I have a single List that I'm trying to save that's about 100kb, is there any way to measure the efficiency or should I "try&fail" approach? Sorry for asking so many questions but I'm trying to understand it :)

    Thanks!
     
  36. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    It depends on the complexity of the objects you're trying to serialize as well as their quantity too, so what type of list are you trying to save? a list of Unity objects?

    I'd be glad to help ❤️
     
  37. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @hasanbayat ,

    I want to purchase a Save System from you, which one should I choose Bayat - Save System or Save Game Pro - Gold Update.
    Thanks!

    P.S:

    I already purchased Bayat - Save System ;)
     
    Last edited: Apr 25, 2020
  38. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    629
    Well you already did it, get the most of it ;)
     
    RoyalCoder likes this.
  39. Centribo

    Centribo

    Joined:
    Nov 3, 2012
    Posts:
    6
    Hey @hasanbayat,
    I'm currently working on a project that uses SaveGamePro and we're looking to publish our game on Nintendo Switch; Does SaveGamepro have Nintendo Switch support at this time?
     
  40. tungdv_unity

    tungdv_unity

    Joined:
    May 31, 2020
    Posts:
    24
    my unity project get many logs for error. please help!
     

    Attached Files:

    • 1.png
      1.png
      File size:
      302.4 KB
      Views:
      300
  41. Arcanebits

    Arcanebits

    Joined:
    Dec 18, 2013
    Posts:
    108
    Hi, I have to Serialize an audiofile recorded witht he mic, to be lownloaded and played later on or by demand, any advice onto that?