Search Unity

BG Database (inMemory database | Excel/Google Sheets syncing | CodeGen | Save/Load support)

Discussion in 'Assets and Asset Store' started by BansheeGz, May 3, 2018.

  1. Irishall

    Irishall

    Joined:
    Dec 9, 2016
    Posts:
    16
    Hi @BansheeGz
    Can I include multiple of the same Entities in "relationMutiple Field"?
    For Example: [Enemy A, Enemy A, Enemy B, Enemy B, Enemy A, Enmey C ...]
     
  2. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hi,
    No, relationMutiple field contains a distinct list of entities without duplicates.
    We could add a new relational field with duplicates support (or maybe add "allow duplicates" configuration parameter to relationMutiple field)
    Please, let me know if you are interested
     
  3. Irishall

    Irishall

    Joined:
    Dec 9, 2016
    Posts:
    16
    That's the solution I need! both look nice.
     
  4. Poupi

    Poupi

    Joined:
    Jan 11, 2012
    Posts:
    111
    Hi,
    I'm interested in this feature too (think of a deck of cards that can contain the same card multiple time).

    Thanks a lot !
     
  5. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hello,
    We've added an option to use string/int field values as IDs
    Also there is a new option to use row's index as ID (e.g. first database row is mapped to the first Excel/GoogleSheets row etc.)
    You can change rows mapping strategy under Export/Import->Data sources->Rows mapping config
    I've sent updated packages to you in a private message
    Please, test it with new empty Excel file to make sure it works as expected and let me know if something is wrong
     
  6. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hello, we've added support for duplicate values for relation field
    I've send updated package in a private message
    Please, let me know if something is missing
     
  7. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hi, please, check private messages- I've sent you an updated package
    Please, let me know if it does not work as expected
     
  8. Irishall

    Irishall

    Joined:
    Dec 9, 2016
    Posts:
    16
    It works successfully! Thank you
     
  9. Poupi

    Poupi

    Joined:
    Jan 11, 2012
    Posts:
    111
    Yes this is perfect, thanks a lot !
     
  10. AdrianoDeRegino

    AdrianoDeRegino

    Joined:
    Aug 10, 2019
    Posts:
    87
    i, I´m having a error on building to Android with the new adressables update "1.1", using the first 1.0 version it works again.

    The error points to: \com.unity.addressables@1.16.19\Runtime\ResourceManager\AsyncOperations\AsyncOperationHandle.cs:20
     
  11. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hi, our addressables plugin v.1.1 requires Addressables version 1.17.17 minimum

    If version 1.17.17 does not show up in the Package Manager- open {YourProjectFolder}\Packages\manifest.json file in the text editor and set Addressables to version 1.17.17 manually as shown on the screenshot below
     
    Last edited: May 26, 2021
  12. RuaaTech

    RuaaTech

    Joined:
    Apr 26, 2021
    Posts:
    9
    Hi I’m AR developer, and I want to make an AR application will work in this way; the doctor look at a patient record using AR glass, he will see the heart and a data will come as text in the same scene, the data in the text showing his heart beat rate, which is coming from the hospital database which is downloaded from the hospital cloud. As the hospital data’s will be uploaded all the time to the cloud, and the AR application will take those data from the cloud. Is it possible with your asset please?
     
  13. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hi!
    Sorry, no, our database is a client-side database, which is used mainly as a replacement for scriptable objects
     
  14. Studiomaurer

    Studiomaurer

    Joined:
    Sep 5, 2012
    Posts:
    56
    Why? One of the main benefits of a Database is that you can collect Data in it. If it is not possible to save that data in builds, what is the point? Am I missing a core concept of bgdatabase?
     
  15. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Database data can be saved at runtime, but saving the database inside Unity editor and saving the database in builds are different.

    When we save the database inside Unity editor, we have a database file and we have write access to it- so all we have to do is overwrite this file.
    When we deploy our application to a player device- we do not have write access to database file anymore (at least on mobile platforms) and if we use Resources loader- we do not even have a file, cause the database file is packed along with other data.
    So the database file, shipped with the game files, becomes read-only data on player's devices

    1) The most obvious workaround would be saving the whole database to some file under Application.persistentDataPath folder ( https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html ) using BGRepo.I.Save() method to get database content, and loading this file at application startup and passing its content to BGRepo.I.Load() method.
    In this case, we again have a database file and read/write access to it.
    But this method has a huge disadvantage- the developer will not be able to update database data in the next releases- cause the whole database is stored locally on players devices

    2) That's why we tried to create an alternative method for saving/loading database- SaveLoad add-on
    SaveLoad add-on configuration splits the database into two parts- dynamic (data, which can be changed during play session) and static(read-only).
    When you save the database using Save/Load add-on- only the dynamic part is saved
    When you load the database using Save/Load add-on- the main database, which is shipped with the game, is loaded first and only after that the dynamic part is merged with the main database
    By using this method- the developers can update the static part between app/game releases, change addons settings, add new fields/tables.
    More information about Save/Load add-on can be found on its home page: https://www.bansheegz.com/BGDatabase/Addons/SaveLoad/

    Please, let me know If you have any questions
     
  16. AdrianoDeRegino

    AdrianoDeRegino

    Joined:
    Aug 10, 2019
    Posts:
    87
    Amazing, thanks!
     
  17. AdrianoDeRegino

    AdrianoDeRegino

    Joined:
    Aug 10, 2019
    Posts:
    87
    Hi, I´m using Save/Load Bolt addon, and it was all good, but today I´v started seeing a strange behaviour, when I save, the file ".sav" is created perfectly I can even load it and its all fine, but if I exit play mode, when I click "enter play mode" again, the file disappear and I got this error:
    upload_2021-6-9_16-42-32.png

    I've played a scene that has no Save/Load logic, even any BG db logic, and the file still vanishes.

    Any idea what may be causing it?

    Unity 2021.1.9f1 and UnityVs 1.6.1

    Also, just updated windows 10
     
  18. AdrianoDeRegino

    AdrianoDeRegino

    Joined:
    Aug 10, 2019
    Posts:
    87
    I´m currently trying to upgrade BG database and etc...

    (EDIT) No success, the file is gone as soon the game started playing.
    (EDIT2) Playing an empty scene and the file stills there,... Will investigate my starting scene.
    (EDIT3) Found it, I was checking if the app version changed and deleting user data in some situations, but never setting the new version again. sorry.
     
    Last edited: Jun 9, 2021
    BansheeGz likes this.
  19. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hi, thank you for the update
     
  20. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    49
    Is there a best-practice for tamper-detection of the BG database data? I see that encryption is supported, but not necessarily recommended. Assuming that the data could eventually be tampered with, what's the most appropriate way to detect the tampering?
     
  21. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Unfortunately, currently, there is no tamper protection/detection feature available
    If you know of any good algorithm for data tamper detection - please, let me know
    As far as I understand, if data protection is critical- the best way to protect the data is to keep it on the server but this solution requires an online connection
    Regarding encrypting/decrypting database data- we support any algorithm- but we doubt it can be done efficiently
    Maybe it can make data decrypting a little bit harder at best
     
  22. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    49
    Would the BansheeDB event listener trigger if a database value was edited in memory? Our database is used in a read-only situation for tuning, asset references, etc, so we would never expect the data to change.
     
  23. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    No, the event will not be fired
    We are not experts in this field, but probably even if we implemented the data change detection algorithm for read-only data- it won't protect against data tampering, cause all the checks can be bypassed with code injection
     
  24. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    49
    Got it, thank you for the info.
     
  25. NightOwlGamingLLC

    NightOwlGamingLLC

    Joined:
    Jun 14, 2014
    Posts:
    9
    I've been trying to get this working with either Bolt or Flow Canvas but I can't seem to get any of the BG Database actions to appear in either, I check the generated class and all there is is this:

    using System;
    using System.Collections.Generic;
    using BansheeGz.BGDatabase;
    using UnityEngine;
    using FlowCanvas;
    using ParadoxNotion.Design;
    //=============================================================
    //|| Generated by BansheeGz Code Generator ||
    //=============================================================
    namespace MySpace
    {
    #pragma warning disable 414
    #pragma warning restore 414
    }

    What am I doing wrong here?
     
  26. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    It looks like the code was generated when your database was empty (i.e. it did not have any tables)
    After changing database structure (i.e. adding/renaming/removing tables or fields), click on "CodeGen" button as shown on the screenshot below to re-generate the Bolt/FlowCanvas units/nodes
    Probably, we need to add an option to execute code generation automatically while saving the database if the database structure was changed
     
  27. Philkrom

    Philkrom

    Joined:
    Dec 26, 2015
    Posts:
    90
    1. Hello, I am using Trilib2 and if I add the BGDatabase Excel plugin (last version + last plugin version) I get a conflict with ICSharpCode.SharpZipLib.dll. Is there an easy way to fix this?
    Best regards, Phil
     
  28. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hello, it's quite easy to fix
    Please, follow 2 steps guide below

    1) Locate ICSharpCode.SharpZipLib.dll file, shipped with our Excel plugin.
    The default location is {Your_Project_Root}\Assets\BansheeGz\BGDatabaseExcelEditor\Editor\Libs\ICSharpCode.SharpZipLib.dll
    Select this file in the "Project" window and deselect all target platforms and click on "Apply" button as shown on the screenshot
    Alternatively, you can simply delete ICSharpCode.SharpZipLib.dll file

    2) After that select all DLL files (by holding Ctrl key) in the same folder ({Your_Project_Root}\Assets\BansheeGz\BGDatabaseExcelEditor\Editor\Libs\), uncheck "Validate Reference" and click on "Apply"
     
    Philkrom likes this.
  29. Vorren

    Vorren

    Joined:
    Oct 24, 2014
    Posts:
    19
    I'm getting the "Please download Odin inspector" popup when generating MonoBehaviors (trying to enable Odin tickbox) - Odin is installed. Seems like a bug.
     
  30. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Please, download and install the plugin, I attached to this message.
    This package can also be downloaded from this page: https://www.bansheegz.com/BGDatabase/Downloads/Uncategorized/
    The error message is very confusing- we will change the error message in the next version

    Sorry for the inconvenience
     

    Attached Files:

  31. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Hello,

    Hoping to get some answers on the runtime editor:

    1. How can I edit the GUI settings, for example set page size default 100 or more? When file is loaded its default to 20 and maximum it can be changed to is 100
    2. Remove options such as "Tools" or disable certain buttons
    3. Change the Title "BGDatabase" to something else for example the current Table Loaded
    4. Change colors of entity for example if int is less than 0 turn red
    5. Highlight whole row
    6. When I change Database settings in editor example select Hidden fields, for them to be hidden in the Runtime editor as well
    7. Is there a way to apply a GUI skin to it?

    Thank you
     
  32. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hello,

    None of the features you mentioned is implemented, but, probably, we will be able to implement most of them (maybe all)
    Please, read my comments below

    1) We could add persistent settings, which are saved between sessions to a file (we will add a button to save settings)

    2) For default values, we could add a text field with default settings in JSON format (the text value can be copied from the editor settings file)

    3) We deliberately added a limit of 100 rows per page, cause the number of rows on the page affects the performance
    Editor GUI has a viewport, so the page size does not affect performance.
    To remove 100 rows limit we need to implement a similar viewport for the runtime editor

    This is quite easy to add

    We need to add methods/interfaces, which allow customizing how cells content looks with a little bit of C# scripting

    Probably there should be an option to use the same settings file, editor GUI is using
    This will work ok only if the build is running on the same PC

    I'm not sure right now, but probably it's possible to add support for a custom skin
    Please, keep in mind, that GUI skin will not allow you to resize elements

    I could post the progress updates here if you are interested
     
  33. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Thanks for the update. Yes Certainly please keep me updated, I'd love to see those updates.
     
  34. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Hello again,

    Does it support multiple databases?
    It seems I cannot chose which Meta to import the excel file into, I've structured multiple Excel files each has their own database, and there is another one within Unity, however when I import an excel file as BGMergeModeEnum.Transfer, it will erase the ones already in unity (since they dont exist in the imported excel file)

    Then if I chose the other option which is Merge, it will add to the database even if some of the contents already exists,

    Is my approach wrong or is there a better way to target what database to import into,

    Ultimate goal is to be running multiple databases / excel sheets
     
  35. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hello, I've attached an updated package
    A custom skin is still not supported (we did not even research it yet), but other features should be supported
    Please, read my comments below and let me know if something does not work as expected

    Page size limit is removed.
    Regarding settings, please, read section 6
    Additional settings were added to disable the buttons
    The additional setting was added to change the window title
    We've added an interface which is called before and after cell drawing
    To get it called you need to implement it.
    It can be used to highlight the row or replace text colour.
    I've attached an example class (BGDatabaseTableCellCustomProcessor.cs), which produces the following effects
    Replace table/field names with your own ones
    Also, using code-gen addon can simplify the code

    We've added support for editor settings format and a button for saving the settings
    First of all switch to "EditorFormat" under the "Settings" section
    After that there are 3 options available:
    1) Leave the "Settings File Path" parameter empty (as on the screenshot above). On settings saving the file will be created with the default name under Application.persistentDataPath ( https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html )

    2) Set the "Settings File Path" parameter to a relative path. The setting file will be created under Application.streamingAssetsPath ( https://docs.unity3d.com/Manual/StreamingAssets.html )

    3) Use absolute path to a setting file
    In this case, you can use the same file, which is used inside Editor

    Also, you can copy editor setting file content to the "Default settings" parameter to use these settings as default settings (if no settings can be loaded)

    To save the settings use the "Save settings" button
     

    Attached Files:

  36. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hello, is it possible that the rows from the same table are located in different Excel files?
    Here is what I mean:
     
  37. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Will let you know once I discover a better example of this,

    For now I'm wondering how can I count total rows in the excel file with actual data?
    I think because some of the file has Tables it counts it as entity even though its empty fields.
    Furthermore if there is a way to only load /import the rows if they are not empty?
     
  38. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    We fixed a similar issue with empty rows recently
    Please, try the attached package, the issue should be solved
    UPD: new version is available for download here (version 1.7) https://www.bansheegz.com/BGDatabase/Downloads/EditorExcel/
     
    Last edited: Aug 8, 2021
  39. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    It's still loading additional rows, likely due to the borders since I tested it in a new file when borders are added it adds a bunch of entities. Perhaps conditional formatting may impact it as well?
     
  40. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    I can not reproduce it by adding borders

    1) Do you use the latest BGDatabase package (version 1.6.9)?
    2) Would you mind sharing your test Excel file so we could test it locally?
    If it has sensitive data- replace it with something meaningless, but do not modify empty rows
     
  41. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    I've PM you the file and settings info
    Yes Version: 1.6.9
    Thanks
     
  42. LanKuDot

    LanKuDot

    Joined:
    Jan 8, 2019
    Posts:
    13
    Hi BansheeGz,

    Thanks for the awesome asset. I want to use the excel importer/exporter in runtime.
    But the import/export settings, such as rows mapping config and merge setting defined in Jobs, and the custom formatter are not applied in runtime.
    I referenced the code of `BGExcelImportGo.cs` to make a simple importer.
    Code (CSharp):
    1.         public bool Import(string filePath, out Exception exception)
    2.         {
    3.             var importManager = new BGExcelImportManager(true);
    4.             var isLoaded = false;
    5.             exception = null;
    6.  
    7.             try {
    8.                 importManager.Import(
    9.                     filePath, new BGMergeSettingsEntity {
    10.                         Mode = BGMergeModeEnum.Merge,
    11.                         AddMissing = true,
    12.                         UpdateMatching = true
    13.                     });
    14.                 isLoaded = true;
    15.             } catch (Exception e) {
    16.                 Debug.LogException(e);
    17.                 exception = e;
    18.             }
    19.  
    20.             return isLoaded;
    21.         }
    Is it possible to make the importer/exporter to use the settings in the loader, or pass them to it?
     
  43. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hello, thank you for the kind words!
    We are working on adding missing settings to Excel runtime plugin.
    I will post it here as soon as it's ready
     
    LanKuDot likes this.
  44. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    @LanKuDot Hello, I have bad news- our developer got seriously ill so we do not have any other choice but to wait for him to recover
     
  45. LanKuDot

    LanKuDot

    Joined:
    Jan 8, 2019
    Posts:
    13
    Got it. Get well soon.
     
  46. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Bad news. :(
    Covid 2019 confirmed
    Not sure when we will be back to provide support (((
     
  47. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    The Covid problem seems to be resolved- we are back to operating normally
    Sorry for the inconvenience
     
    LanKuDot likes this.
  48. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hi!

    We have added missing settings to the Excel runtime plugin:
    1) Names mapping config- allows having any names for sheets/columns and mapping these names to database tables/fields names
    2) Rows mapping config- allows using different strategies for mapping a database row to an Excel row


    Sorry, it took so long to implement
    I will send you updated packages in a private message
    If something does not work as expected- please, let me know.

    We have tested a custom formatter with the latest plugin implementation and it seems to work ok

    You could use BGExcelImportGo's Export/Import methods to launch export/import

    Code (CSharp):
    1.         BGExcelImportGo excel = GetComponent<BGExcelImportGo>();
    2.      
    3.         //to import
    4.         excel.Import();
    5.  
    6.         //to export
    7.         excel.Export();
     
  49. AdrianoDeRegino

    AdrianoDeRegino

    Joined:
    Aug 10, 2019
    Posts:
    87
    Hi!, Glad you got over covid.

    Now I´m trying to change this value using Unity Visual Scripting, but it got pretty complex, do you see a solution for that?

    Thanks.

    upload_2021-8-17_16-19-34.png
     
  50. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    370
    Hi, thank you

    To change the source row for a field data binder, you need to set an entity and field (no need to set a table, cause it is taken from the entity)

    1) If your source code base (Edit->Project Settings->Node Library) includes BGDatabase.dll you can use the following nodes:
    The nodes in the first row can be added by clicking on the BGDataBinderFieldGo component's title in the Inspector and dragging it to VS window.
    The first node set the entity and the second node set a field (using field ID) (the one, which you can find under the "Configuration" tab). And finally, you need to call a Bind method

    2) If your codebase does not include BGDatabase.dll, I could provide you with a custom node to change a source row of the field data binder
     
    AdrianoDeRegino likes this.