Search Unity

  1. Unite Berlin 2018 schedule is now updated with talks on real-time ray-tracing, upcoming 2D features & many more. Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  4. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Game Data Editor: The Visual Data Editor [Released]

Discussion in 'Assets and Asset Store' started by Celestipoo, Jun 6, 2014.

  1. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    Any unity types you link in GDE must be in a Resources folder or subfolder.
     
  2. thomas4d

    thomas4d

    Joined:
    Sep 5, 2013
    Posts:
    31
    Ok thanks Resources folder Worked :)

    OK next how or can you load audio files from spreadsheet import ? or do you have to add to the GDE after you important the spreadsheet ?
     
  3. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    Any unity types is the path *after* resources without an extension, so if your file is "Resources/Audio/wind.mp3" then what you want in the file is "Audio/wind"

    It's easier to link in gde then export your spreadsheet back to Google drive so that there's no typos but you certainly can type them in yourself.
     
  4. NicoVar

    NicoVar

    Joined:
    Sep 21, 2012
    Posts:
    38
    Hi,

    Is there a way to separate the general structure file (schemas) from the actual item data file?

    I want to give the game designer the data file for them to play around with values, but the JSON format also contains all the schemas, which if they break it could mess things up.

    I understand loading from a spreadsheet (local or google) at runtime is not available since I would need to generate the GDE Data classes, but if I could split the schema from the item data it could work fine. Or, if I could re-load a spreadsheet (just the data) in realtime that would also work.

    Here's a quick example on the gde_data file concept. This is a simple gde_data.txt file content:
    {
    "_gdeSchema_Config": {
    "_gdeType_IsConfigOn": "Bool",
    "IsConfigOn": 0
    },
    "ItemZero": {
    "_gdeType_IsConfigOn": "Bool",
    "IsConfigOn": true,
    "_gdeSchema": "Config"
    }
    }

    Is it possible to split this into two?
    The schema file:
    {
    "_gdeSchema_Config": {
    "_gdeType_IsConfigOn": "Bool",
    "IsConfigOn": 0
    }
    }

    And the data file:
    {
    "Config": {
    "ItemZero": {
    "IsConfigOn": true,
    }
    }
    }

    So the data file is clean and I could expose that file for game designers.

    Not sure if this can be done somehow.

    Thanks.
     
  5. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    What you can do is split the file up manually. To initialize, read in both the schema file and the data file into a single string. Then call GDEDataManager.InitFromText() with the string variable that contains the contents of both files.
     
  6. vamky

    vamky

    Joined:
    Aug 9, 2014
    Posts:
    45
    Hi

    I think I have encountered a bug here. I am using GDE 2.6.1 in unity 2017.3, macOS.
    Somehow when I use the playmaker GDE Manager Init Text Asset action to init multiple data files, only the last one is initialized.
    Also the brows button in preference is broken in unity 2017.3, you cannot use it to select data file.
     
  7. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    Initializing with the last data file is by design.
    I'll see about the browse button. You can also browse to the data file in your project view and use the context menu to load the data file.
     
  8. Anflo

    Anflo

    Joined:
    Dec 3, 2014
    Posts:
    17
    I am testing the free version before deciding to buy the product. I am getting this error
    Assets/GameDataEditor/Editor/GDEManagerWindowBase.cs(971,18): error CS0165: Use of unassigned local variable `colorDict'
    On Unity 2017.3
    Unity will not compile with this error.
     
    Last edited: Jan 21, 2018
  9. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    Apply this patch: GDE Free1.4f uninitialized dict fix
     
  10. Sylidar

    Sylidar

    Joined:
    Sep 22, 2015
    Posts:
    1
    Is there a way to change the order my data shows up in the item list?
    upload_2018-3-1_18-39-54.png
    For instance, I would like to move my enemy items to make the order ascending from 001 to 006.
     
  11. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    No, sorting is not supported in GDE editors. However, if sorting is what you are after, the best method is to use a spreadsheet.
     
  12. pikmin36

    pikmin36

    Joined:
    Dec 13, 2016
    Posts:
    7
    Hey Celeste,
    I currently encountered a problem removing an Item from the runtime data and hope that you could help me out:

    When I create an item with GDEDataManager.RegisterItem() it gets created in the ModifiedData dictionary, so far so good.
    But since there is no .RemoveItem() function (btw. why not? Is the GDE data structure not designed to remove items?), I try to remove a runtime item with GDEDataManager.ModifiedData.Remove(<itemname>); and as though this removes the item from the Item Editor, looping through the ModifiedData dictionary still shows that it contains that item with all of its values.
    Am I missing out on something or does the ModifiedData dictionary need to be updated afterwards somehow?
     
  13. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    The ModifiedData dictionary isn't meant to be used directly. Instead, access your data using generated data classes. Read here: http://gamedataeditor.com/en/docs/using-gde-data-classes.html

    When creating a new item, use the constructor with a unique ID.
    Code (csharp):
    1. GDEExampleData newItem = new GDEExampleData("some_guid");
    To delete that item, use Reset All:
    Code (csharp):
    1. newItem.ResetAll();
    To save your changes, whether that's saving new items or deleting items, call Save on GDE Data Manager:
    Code (csharp):
    1. GDEDataManager.Save();
     
  14. pikmin36

    pikmin36

    Joined:
    Dec 13, 2016
    Posts:
    7
    Good to know, but that poses another problem in my situation: Since I only use GDE in combination with PlayMaker and want to create custom actions, one for creating and one for removing an item at runtime, it would need to be independent of the user data. Is there maybe a different approach in which the user just enters any item name as a string and that item would then be removed?

    Also since I use PlayMaker (and the QuickStart guide also says to skip generating GDE Data Classes in that case), whenever I try to generate those I get the error: "DirectoryNotFoundException: Could not find a part of the path <path-to-random-location-in-Assets>\GDESchemaKeys_gde_data.cs" (already tried re-importing GDE to no avail). What could be the cause of that?
     
  15. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    Ah, I see. I don't have a playmaker action that's the equivalent of ResetAll method. Here's the guide for playmaker: http://gamedataeditor.com/en/docs/playmaker-quickstart.html

    I'm not sure what that error is but if you give me the full exception, maybe I can track it down.
     
  16. pikmin36

    pikmin36

    Joined:
    Dec 13, 2016
    Posts:
    7
    Stacktrace:
    Code (CSharp):
    1. DirectoryNotFoundException: Could not find a part of the path "C:\<...>\Assets\__SharedAssets\Scripts\Components\_Third Party\GameDataEditor\CustomExtensions\GDESchemaKeys_gde_data.cs".
    2. System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:292)
    3. System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
    4. (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    5. System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
    6. System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding)
    7. (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding)
    8. System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:626)
    9. System.IO.File.WriteAllText (System.String path, System.String contents) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:621)
    10. GameDataEditor.GDECodeGen.WriteFile (System.Text.StringBuilder sb, System.String fileName) (at Assets/GameDataEditor/Editor/CodeGen/GDECodeGen.cs:168)
    11. GameDataEditor.GDECodeGen.GenStaticSchemaKeysClass (System.Collections.Generic.Dictionary`2 allSchemas) (at Assets/GameDataEditor/Editor/CodeGen/GDECodeGen.cs:79)
    12. GDEMenu.DoGenerateCustomExtensions () (at Assets/GameDataEditor/Editor/GDEMenu.cs:115)
    I would assume that one of the scripts is searching for the folder called "GameDataEditor" and since I named my folder for custom extensions the same as the GameDataEditor folder that might have lead to this conflict.


    Regarding my initial question: I wasn't asking if there is such an action that removes or resets an item, but rather trying to create one myself :p
    I already created several custom actions for GDE (which can be found <here>), but when it comes to removing runtime items it didn't seem to be easily do-able; which is why I would like to know if there's a way to manipulate the modified data without knowing what the data of the action-user looks like.
    Maybe some "hacky" approach, maybe there's already a function in GDE that would serve a similar purpose. My last straw would be to try to rebuild the modified data without the item that's supposed to be removed, but that seems to be terribly inefficient, especially the more data the user has.
     
  17. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    @pikmin36 It looks like its not finding the full path of your project. This "<...>" should be a full path. Anyway, that's awesome :) I was hoping you'd be able to generate the data classes because then you'd be able to see what the ResetAll method does and use that as a guide to write the action.

    In any case, I looked at one of my generated classes and here's the gist. Call ResetToDefault with the item ID you want to delete and field that exists in that item's schema

    Code (csharp):
    1. GDEDataManager.ResetToDefault(item_id, field_name);
    If your item has any custom fields, you need to follow the same convention.
    Code (csharp):
    1. // First reset the custom field
    2. GDEDataManager.ResetToDefault(item_id, custom_field_name);
    3.  
    4. // Then reset all of the custom field's fields
    5. GDEDataManager.ResetToDefault(custom_item_id, custom_fields_name_1);
    6. GDEDataManager.ResetToDefault(custom_item_id, custom_fields_name_2);
    Etc, where custom_item_id is the ID of the item that was linked in the item you are deleting.

    On the subject of removing items, curiously enough the system wasn't designed to remove items. It wasn't really designed to add items either. Originally, it was for a base set of data that is easily modified and reset to original values. Later on, the ability to create new items at runtime was added. GDE has grown mostly from user suggestions and from my own desire to create a package that's so intuitive, the support I need to provide is greatly reduced ;)
     
  18. pikmin36

    pikmin36

    Joined:
    Dec 13, 2016
    Posts:
    7
    I actually just obfuscated my local path with <...> :rolleyes:
    ...but I was right in assuming that it has something to do with the naming: after I changed the name of my own "GameDataEditor" folder it started correctly generating the data classes, meaning one of the scripts is searching for the first occurrence of that folder name and thinks it's the main GDE location.
    As a side note, it would probably be good if the generator script for the data classes could remove any special characters and whitespaces from the variable names or replace them with underscores, otherwise you have a hot mess like i do (see attached picture) and it just unecessarily limits how you can name items.

    Adding and removing items at runtime would seem to be a vital part of videogame data, especially when it comes to collecting items with random stats like in most RPG's or survival games, which is also what I currently needed to implement.

    Weirdly the ResetToDefault() functions seems to work, even though it's also just calling ModifiedData.Remove(itemName) like I did initially, but thanks a lot for helping me out here.
     

    Attached Files:

  19. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    That's funny. I remember writing that code and thinking to myself "If someone has two folders called GameDataEditor this isn't going to work. Why would anyone do that? They wouldn't do that..." It took 4 years to hit that case ;) FYI, You can move around those generated classes in your project and they will get updated in place if you generated them again.

    I vaguely remember having a regex that converts names to valid C# variable and class names. I'll take a look and see why that's not doing what its supposed to be doing.
     
    Last edited: Mar 7, 2018
  20. thatscraigz

    thatscraigz

    Joined:
    Mar 27, 2015
    Posts:
    18
    Hi @Celestipoo ! Quick clarifying question per @vamky on initializing data/workflow.

    Is it then only possible to have ONE file initialized at a time?

    If so, is it best to just create a mega-file with ALL the data in it vs. separate data files for parts of the game?
    example: gde_audio.txt , gde_mapData.txt, gde_equipment.txt, etc.

    Thanks for the awesome support! Looking forward to the next update! :D
     
  21. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    326
    Currently, you can only have one file initialized at a time. But you can load different files at will as you move through your game. It all depends on how you want to set it up.
     
  22. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    402
    It may seem silly, but I was quite put off by the huge colorful "CLICK HERE TO RATE!!!!" button. Even you almost clicked it by accident in your video because it seems like it should be there the continue / done / whatever button should be.