Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bayat - Save System - An ultimate data management solution

Discussion in 'Assets and Asset Store' started by hasanbayat, Jan 28, 2020.

  1. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Last edited: Feb 6, 2020
  2. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    It is now live on the Unity Asset Store
     
  3. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,176
    Hey there, just a quick question, I own Save Game Pro - Gold, is that no longer going to be relevant?
     
    hasanbayat and f1chris like this.
  4. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Thanks for the question, the Save Game Pro will be in maintenance mode, that means it will only receive bug fixes and patches, no new features, for having new features and capabilities I'd suggest you to use the new system, but if you're already using Save Game Pro for your projects, you're good to go with them as long as you don't want the new features, cause it'll remain as it is, with just few patches and bug fixes.
     
  5. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Added FAQ to the manual, let me know if you've any other questions, so it might be added to the FAQ as well.
     
  6. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Hi, Does this save system have any cloud sync functionality via native API's for IOS(iCloud) or Android (Google storage)?
    How long do you plan to run special launch promotion for this save system so that i can plan accordingly.

    Thanks.
     
  7. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Hello, thanks for the question.
    Unfortunately, no, there is no integration available for iCloud and Google Play Games Services (Saved Games) yet, but they're both on our roadmap which we're going to implement both of them as soon as possible and also we're planning to add integrations with cross-platform plugins available on the asset store such as Cross Platform Native Plugins and Ultimate Mobile Pro too.

    Check out the Roadmap for more information.
    Also, the launch sale will be around for 2 months.
     
  8. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Bought it yesterday. I have 2 questions so far:

    - When saving and loading basic basic forms like (cube, sphere) it’s pretty fast when with my enemies, saving & reloading like 10-12 characters is slowing it down a bit ( save file is around 15mb). So my first question is how can i just save the location and things like health and respawn a prefab with new loaded position ?

    - second question is about auto-save: I like the feature but trying to use with additive scenes. Anyway to add OnSceneLoaded () trigger to the list ?

    Thx
     
    hasanbayat likes this.
  9. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Thanks for the questions.

    In your case it would be better to create a data model just for position, health and enemy data at all, something like this:
    Code (CSharp):
    1. public class EnemyData {
    2.  
    3.     public Vector3 position;
    4.     public float health;
    5.  
    6.     // add more properties here
    7.  
    8. }
    Which you can extend it for other enemies:
    Code (CSharp):
    1. public class OtherEnemyData : EnemyData {
    2.  
    3.     public int headHealth;
    4.     public int bodyHealth;
    5.  
    6. }
    Then save and load it like this:
    Code (CSharp):
    1. // Loop through your enemies and fetch the data and fill this list
    2. List<EnemyData> enemiesData = new List<EnemyData>();
    3.  
    4. // Loop here ...
    5.  
    6. // Save the data
    7. await SaveSystemAPI.SaveAsync("enemies.dat", enemies);
    8.  
    9. // Load back the data
    10. List<EnemyData> enemiesData = await SaveSystemAPI.LoadAsync<List<EnemyData>>("enemies.dat");
    11.  
    12. // Then instantiate enemies based on the EnemyData type maybe?
    13. if (enemiesData[i] is OtherEnemyData) {
    14.     // Instanitate otherenemy prefab ...
    15. }
    This is the solution I've got in my mind so far, but I'm pretty sure you might be able to do it simpler or better anyway.

    Or maybe instead of doing it all, just create an object converter for Enemy component and get a list of your enemies and save it like this:
    Code (CSharp):
    1.  
    2. Enemy[] enemies = FindObjectsOfType<Enemy>();
    3.  
    4. // Save the enemies component data which is managed by its own Object Json Converter
    5. await SaveSystemAPI.SaveAsync("enemies.dat", enemies);
    6.  
    7. // Load the data back into enemies (components)
    8.  
    9. // Use Load if the enemies (components) are referenced by Scene Reference Resolver, otherwise use LoadInto to directly load the data into them
    10. await SaveSystemAPI.LoadAsync("enemies.dat");
    11. await SaveSystemAPI.LoadIntoAsync("enemies.dat", enemies);
    Learn more about Creating a Custom Object Converter.

    And for your second question, that would be a good addition, but for now, I think you can extend the AutoSave class to add this event or just modify the AutoSave script.
    But I'll try to include this event in the next update.

    Learn more about sceneLoaded event.
    Thanks ❤️
     
  10. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Thank you so much. That's exactly the alignment i needed !!
     
    hasanbayat likes this.
  11. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    The new version is now live on Asset Store, 1.0.3:

    New features
    • Added On Scene Loaded event to AutoSave Manager
    Bug fixes
    • Fixed LoadAsync and LoadIntoAsync encryption issue
    • Enforcing .NET 4.x using a dialog box

    Thanks for staying with us ❤️
     
  12. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    We've found an issue with serializing MeshFilter component, which saves the mesh property instead of saving only sharedMesh property, so the whole mesh data is saved instead of just saving the reference of it.

    This issue has been addressed and will be fixed in the next update.
     
  13. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Added pagination to the Asset Reference Manager and Scene Reference Manager windows for optimizing the performance with a large pool of references:

    Annotation 2020-02-11 210012.png
    Stay tuned ❤️
     
    Last edited: Feb 11, 2020
  14. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    188
    Sounds good!

    I see you've listed "consoles". Does it work on Nintendo Switch?
     
  15. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    I haven't tested it yet, but if Nintendo Switch supports File storage or PlayerPrefs then it works there too.
    By the way, Nintendo Switch support is on our roadmap so if it requires a native integration, we would have to develop it at that time. (I'm not able to provide an ETA for it though)

    Thanks.
     
  16. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    188
    Thanks for the quick reply. Not sure how much I can say in response to that without breaching any NDAs but I appreciate the response. :)
     
    hasanbayat likes this.
  17. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    For multi-scene saving and loading, how does Save System handle this? Can you save scenes before unloading them, and reload the saved data before they're reloaded? Also, does it have Ludiq Bolt integration?

    Also, how long is the launch sale for?
     
    Last edited: Feb 11, 2020
  18. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Thanks for the question.
    As I stated in the reply at #7 the sale will be around for 2 months.

    You can do that pretty well and easy using Save System, but I didn't fully understand what you meant on your second question, but as far as I know there must be at least 1 active scene which you can operate on and spawn objects or at least access the objects references, so when you load a scene, then you can load the data in Awake or Start events as soon as possible in your case.
    The Bolt works with almost all scripts and assets automatically using its powerful reflection API, you can find a small guide on how to add Save System to Bolt assembly options and use the API there.
     
  19. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    The new version has been submitted for review, will be live on Asset Store soon, 1.0.6:

    New features
    • Added Pagination to Asset Reference Manager and Scene Reference Manager Window
    Bug fixes
    • Fixed saving MeshFilter component mesh property issue
    • Fixed inconsistent line endings issue

    Thanks for staying with us ❤️
     
  20. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Thanks, I don't know why I always ask about Bolt integration, Bolt works with everything :D

    So I guess for multiple scenes, if a scene is unloaded then reloaded, it is the same as it was left when it was unloaded, I think? Unless it resets the scene entirely when it is is unloaded? And during save, if a scene has been unloaded, how would it be saved, since it should technically be saved, it just isn't loaded at the time.
     
  21. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    You can load the data by Start event and then save it by OnDisable event, so you would achieve the functionality that you've expected.
    These events are available in Auto Save Manager, which means you can use Auto Save component for saving your scene objects, this is how your Auto Save Manager might look like:

    Annotation 2020-02-12 194601.png

    Learn more about Auto Save
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,169
    Hi!

    Which consoles does your new save system support with native integration? Does it include examples for those platforms? Are they supported if a customer has a question or issue on a console platform?

    BTW, to answer your question about Switch, it does require native integration. It has its own nn::fs API for file system access.
     
  23. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Hello.
    Thank you for both the question and reply ❤️
    Unfortunately, there are no native integrations included built-in as I don't have any of the consoles for real-world testing.

    By the way, I'm looking forward to adding Native Integrations to the package, and I'd appreciate it if anyone would like to join in place of adding these integrations for consoles.

    The Save System API is flexible and open, so you can easily use the serialization or storage API to implement the native integration for the platform.

    If there were public documentation about file system API for these console platforms, that would be easy to add, but unfortunately, as I'm not a developer for any of these consoles, it is not possible for me to develop the integration at the moment, so any help on this case would be appreciated.

    Anyway, hopefully in the future we'll be in the developer program for these consoles so we will be able to develop the integrations at that moment, but that is not soon.
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,169
    Thank you very much for the answers. Best of luck with your new save system!
     
    hasanbayat likes this.
  25. MortarDeep

    MortarDeep

    Joined:
    Mar 9, 2018
    Posts:
    1
    Hi Hasan,

    I've recently bought Save System (which I love pretty much) and I had a question regarding the native console save system integration.

    Are you planning to port one of the existing features from Save Game Pro such as the Xbox Connected Storage Integration into Save System as I was a bit disappointed when I bought Save System and find out that this feature was not included?

    Is it something that you are planning in your roadmap and if so, do you have a tentative release timeframe?

    Thanks again for this amazing solution!
     
  26. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Looks good! Could each of the scene changes save to a temporary file, and then only when the player goes to the save menu or uses a "save crystal" it could commit the temporary save to an actual file? That way, every scene load/unload would keep the actual state persistent, but the game wouldn't need to actually save it to a file to load unless the user chose to save?
     
  27. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Hello.
    Thanks for reaching out and am so glad you liked it ❤️

    Yes, I'm already implementing Xbox Connected Storage for the Save System, so it might be ready in this month or maybe much sooner.
    Also, I'm trying to use Xbox Live for creators which might be a better choice than XDK, let me know if you have any thoughts on this one as well.
     
  28. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    I think it would be a similar approach to saving the data at a scene change, or maybe have an identifier for temporary scene data, then just save there, but when finalized, save to actual identifier.

    By the way, I'd just save it once the data needs to be actually saved, cause there wouldn't be a need for a temporary file to handle the persistent state.
    It would be better to save it once the user or you want to actually save it, other than that it would be a waste of performance and resources for saving throughout the scene.
     
  29. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Ahh, I'm still getting to grips with how persistent engines work so I assumed this would be the best way to keep the state of the scene after it's been unloaded and a new scene has been loaded in?
     
  30. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Yeah, just save it when the scene is getting unloaded and load it back once the scene is being loaded.
     
  31. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    249
    Hi there,

    nice to see this great save system.
    I'm the developer of Databox and I saw the comparison table at your homepage. I'm kind of in urge to clarify some things as it spreads false information about Databox. I hope you understand ;)
    So let me just go through the points:
    • Databox has PlayMaker support.
    • Databox can serialize anything thanks to OdinSerializer and FullSerializer support. (Json and Binary)
    • Databox can save assets and scene objects by reference. (Resource type) It also supports the new Addressables.
    • Additionally Databox also supports cloud sync, has a runtime editor to modify values during your game and supports Google spreadsheet import.

    I hope you will change your comparison table. Thank you!
     
    hasanbayat likes this.
  32. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Sure, sorry about misleading and misunderstanding, will update soon.
     
  33. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Just updated the comparison table, check if it is what you have expected, thanks ❤️
     
  34. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    249
    Thank you! :)
     
  35. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Thank you really for pointing it out, let me know if there were any other issues and honestly sorry about the misleading information ❤️
     
  36. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    One more question (sorry!) how fast is the saving? Since I'm saving and loading additive scenes asynchronously, how much time does it take to save, and would it cause any lag? Obviously, this depends entirely on how much there is to save, but on average, is it a fairly fast process?
     
  37. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    I haven't done any benchmarks yet, but according to the Json.NET benchmarks, it is pretty fast cause Bayat.Json is a modified version fo this library which also improves the performance by itself too:
     
  38. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    That seems like it would be negligible for saving just a few objects boolean states, which I’m looking to do. In regards to my previous question, I don’t suppose it’s possible to save the data internally rather than to a file for scene changes, and then commit the internal save data to a file when needed? I did ask earlier about using a temporary file, but I’d be interested if the data could be stored without keeping in an external file but just in memory for a persistent engine, and then take that data and save it when requested by the user?
     
  39. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Can you test it on iOS. I had to remove it for now , was getting errors on building for iOS
     
  40. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Unfortunately, I don't have an iOS device, would you provide the error information that I'd be able to investigate and debug it?

    Thanks ❤️
     
  41. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Unfortunately, there is no built-in storage included for that yet.
    By the way, the system's storage API is pretty flexible, you can implement custom storage called MemoryStorage maybe for this specific purpose and implement it the way you wish, you can look into PlayerPrefsStorage and LocalDiskStorage for inspiration, maybe just duplicate them and just modify where you want to act differently.

    But if I wanted to do something like that, I'd prefer to use an identifier like "my-temp.dat" and then when the user wants to save it, then I move/rename "my-temp.dat" to "my-actual.dat", which might be easier in your case.

    Hope this helps ❤️
     
  42. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Thanks, that's a good suggestion! Are there any plans to add a temporary internal saving system that's basically un-hackable by the player, that could then be saved to a file when the game allows?
     
  43. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Ok when i have some times I'll create an iOS project with just your asset to see if I can isolate the problem.

    I think you can still build for iOS even if you don't have a device but the simulator. I was getting the error on building not on running on iOS device.
     
  44. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Ah sorry, I thought the errors were from an actual run, well I'll try to do a build and check, thanks.
     
  45. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Thanks to check. I'm not home until Wednesday late at night to give you more infos. I remember I've downloaded the examples. May be something in my project (a huge 30gigs one) interfering as well. I'm using latest 2019.3.1f release with URP.

    For sure if you try to build one of your demo for iOS in a new project we'll have a clean shot at it :)

    thx
    Chris
     
  46. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    I did an iOS test build with 2018.1 now and I didn't get any error regarding scripts, just a few assertion errors which might not be important at all that you can see in the below image:
    Annotation 2020-02-18 152704.png
    By the way, the build was successful.
    I'll try a build with 2019.3 as well, but I think it might be interfering with assets.

    Thanks ❤️
     
  47. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Thanks for taking some time to test it.
     
    hasanbayat likes this.
  48. Scott_Holden

    Scott_Holden

    Joined:
    Apr 18, 2019
    Posts:
    2
    Can this support enterprise on premise Oracle databases?
     
  49. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    626
    Of course, but there are no built-in integrations for that, so you might have to create the integration for the Oracle database, on both client and server-side.

    Let me know if you have any other questions, thanks ❤️
     
  50. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Hi, I'm tried again on a fresh project with latest Unity 2019.3.2f1 , latest URP 7.2 .

    I tried to build your Saving & Loading Scene Objects demo example. I'm more concern about the Failed to write file to resources.assets error.

    Don't know if i have something wrong setup in my project or what ?

    thx
    Chris
     

    Attached Files: