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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    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:
    379
    Ok, that sounds odd. Let me run that version and check it out.
     
  2. artilla

    artilla

    Joined:
    Jul 8, 2017
    Posts:
    14
    I found the reason. When exported, the file saved as an excel file with xslx. I converted it to google spreadsheet. Then I can import it without 403 error.
    But I found one more error. When I export it, GameObject field is set to none.
    Do you have any idea?
     
  3. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    I can replicate the spreadsheet bug so I'll fix it. About the GameObject, make sure any unity types are in a Resources folder or subfolder.
     
  4. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Here's the patch for that spreadsheet bug. I'll get that submitted asap.
     
  5. Chaiyasak

    Chaiyasak

    Joined:
    Apr 11, 2014
    Posts:
    2
    How to use custom enum on 2.7 version?
     
  6. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Make sure your enum is defined in the GameDataEditor namespace like this:

    Code (csharp):
    1. namespace GameDataEditor
    2. {
    3.   public enum MyEnum { Example, Etc }
    4. }
    And it will show up in the custom enums list when you are editing your schema.
     
  7. Chaiyasak

    Chaiyasak

    Joined:
    Apr 11, 2014
    Posts:
    2
    OH! Super fast support thank you very much. Cool!!!
     
    hopeful likes this.
  8. zfy1045056938

    zfy1045056938

    Joined:
    Mar 19, 2018
    Posts:
    2
    hello Celestipoo,
    i can't import data from excel (data > AZ )data, how to fix that? thx
     
  9. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Hey sorry for the delayed response. Sometimes I don't get notifications from the forum.
    Look in GameDataEditor/Editor/ExcelImport/GDEExcelDataHelper.cs line 135

    Code (csharp):
    1. var nameRow = sheetCells["b"+fieldNameCell.Row+":az"+fieldNameCell.Row];
    Change the az to whatever you need.
     
  10. Fariel

    Fariel

    Joined:
    Feb 9, 2013
    Posts:
    29
    Question for ya. I'm trying to generate some weighted tables using data created with GDE. I'm running in to an issue with creating the weights. I might be going about this the wrong way, but if not then I think I have a feature request. Let me explain.

    I have a list of base swords. I want to create a 'drop list' that has a specific base item (such as BaseSword1) and a weight associated with it. I also want to create a drop table that has a collection of drop lists, which I can then sum the weights from and make selections. The drop table seems to work fine, except I cannot create the weights with the lists. Ideally I would be able to create a 'tuple' type of some sort - something like (BaseSword, int), that I could create a list of.

    I think my disconnect is in how to create a list of already-created data with an additional field next to it, like a weight.
     
  11. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    What you are looking for is Custom Types. What you'd do is create an additional schema, "WeightedSword" for example. And this schema would contain two fields:

    Code (csharp):
    1. BaseSword sword;
    2. int weight;
    And when creating a WeightedSword, you can set the Sword field to your BaseSword1 and set the weight to whatever you like. And when you load that item in your game, you'll have access to the BaseSword1 data through the WeightedSword item. Take a look at: Custom Data Types
     
  12. Skyline520

    Skyline520

    Joined:
    Jan 14, 2016
    Posts:
    8
    After I updated the lasted version from v2.6.1, I got those errors. :(
    I use Unity 2018.4.24f1

    Edit: I changed to Runtime .NET 4.x, then the problem is fixed
     

    Attached Files:

    Last edited: Jul 4, 2020
  13. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    I came back to say just that. Fantastic :)
     
  14. iamindrajit

    iamindrajit

    Joined:
    Jun 5, 2013
    Posts:
    4
    How to change this path?
    I am getting this warning
    'D:/Game Development/MissingTCSCode/Assets/GameDataEditor/Resources/gde_data.txt' does not exist
    And when I am trying to GenerateGDEdataclasses I am getting this error

    Code (CSharp):
    1. ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    2. System.Reflection.Assembly.GetTypes () (at <fb001e01371b4adca20013e0ac763896>:0)
    3. GameDataEditor.GDEItemManager+<>c.<LoadEnumValues>b__63_0 (System.Reflection.Assembly t) (at Assets/GameDataEditor/Editor/GDEItemManager.cs:460)
    4. System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    5. System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    6. System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    7. GameDataEditor.GDEItemManager.LoadEnumValues () (at Assets/GameDataEditor/Editor/GDEItemManager.cs:460)
    8. GameDataEditor.GDEItemManager.Load (System.Boolean forceLoad) (at Assets/GameDataEditor/Editor/GDEItemManager.cs:452)
    9. GDEMenu.DoGenerateCustomExtensions () (at Assets/GameDataEditor/Editor/GDEMenu.cs:142)
    The path shown in the picture is from another computer. How do I change it for this computer?
     

    Attached Files:

  15. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Navigate to the gde_data.txt file in your project. Right click the file and go to the GDE menu at the bottom and select Load. That should fix the path issue and save it in your local settings. The exception generating data classes might be related.
     
  16. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    900
    What's the correct way to reset (flush unused keys) runtime data at runtime? I've just been banging my head with some phantom keys, with a bunch of CHAL_nn keys appearing in my runtime data from an older version of the spreadsheet. I'd delete them from the viewer (select runtime key, press reset button) but they'd show up in my game still and then in the viewer as runtime entries. I've also used GDEDataManager.ClearSaved(); triggered from a flag as the first thing my game does, but the keys persist.

    I've just found "Reset Runtime Data" in the editor menu and it's cleared them out fine. I need to be able to do this in game for players updating and needing to clear out old data.

    Cheers!
     
  17. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Probably a bug somewhere. ClearSaved() should delete the runtime data file completely so any keys should be removed. However, I wonder if the keys stuck around in memory and that's what you are seeing. I'll take a look. But if you can send me a small project that replicates the problem that will help.

    Also, is this problem in the editor in playmode or are you seeing this on a device?
     
  18. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    900
    I've only seen it in the editor at the moment on a Windows target platform.

    I have a bunch of items which I reward for challenges. Challenges are defined as a list of parameters in a Scheme. So for example I'll have a Weapon A that is rewarded for CHAL_00, where CHAL_00 is a key defining a bunch of attributes for
    the challenge.

    I had a load of place-holder values stuck in, CHAL_10, CHAL_02, which were loaded in testing. I then updated the database with the removal of all these basic numbered items and replacing them with stuff like CHAL_C00 and CHAL_W00. On running the game in Editor, the old CHAL_nn values were appearing. I scoured the database for entries and they aren't there. Then I tried the editor flush and that's worked.

    At this point though, that's as far as testing and bug detection has gotten. I'll update with more info as it presents itself. I'll try a Steam beta build today.

    Edit: It looks to be related to clearing the data and then accessing it quickly. I call ResetData() at the beginning, but then go through reading the data and populating the icons. I've just tried ResetData() in a separate test scene and then launched the main scene and the rogue entries are gone. I wonder if it's related to OS-level file IO limitations? If it deletes the file, will we need a flag to be able to wait until ResetData() has completed?

    Checking the C# documentation, it may be more effort than it's worth to include in GDE, and instead perhaps just add to the documentation that there can be a file delay. Us users can then handle that however we choose, such as putting in a small pause.
     
    Last edited: Aug 5, 2020
  19. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    900
    How do I check to see if a key (DB item) exists before using New()? At the moment I'm using New() and it creates a new runtime value, which then creates empty fields that messes me up. I need to ignore the field if the key doesn't exist.

    I know we covered this a long time ago but I can't find the solution!

    Edit: Found it:

    GDEDataManager.DataDictionary.ContainsKey(string key)

    There may not be an issue with the clearing of game data. It may have been a result of referencing an item by name and that item not existing.

    That is, I have a challenge item called CHAL_A00. I have a weapon item with a Challenge field with the value CHAL_00. I call "GDEChallengeItem(weapon_challenge_key)" and where that key doesn't exist in the database, it gets created. I need to be more particular in my testing but I'm rushing to get a long overdue update out! I'll let you know what I eventually find. For the time being, I've just found testing for the key and only accessing it via "new GDEChallengeItem(key)" when the key exists seems to work enough for my update.

    Incidentally, I'd really prefer the option to only access a key if it exists by default rather than always creating a new key. My own preference would be something like

    new DatabaseItem(key)

    returned null if the key isn't already present, with a flag to create a new item if not present,

    new DatabaseItem(key, createIfNotPresent = false)
     
    Last edited: Aug 6, 2020
  20. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    No worries, you can use GetAllKeysBySchema() and then see if the key exists in the returned list. Or, if you want a faster operation, you have access to GDEDataManager.DataDictionary that you can check. However, if you go the DataDictionary route, that will not include any runtime data items. You would need to check ModifiedData dictionary as well.
     
  21. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    900
    Cheers. I'm not (deliberately!) creating any runtime keys so GDEDataManager.DataDictionary suits me perfectly.
     
  22. Lightrail

    Lightrail

    Joined:
    Apr 12, 2013
    Posts:
    37
    Hi there! I'm currently experimenting with Game Data Editor for use in my current project mixed with PlayMaker and after reading around I wanted to get confirmation on some things.

    I'm making a game that might have multiple save files. From what I understand, in order to save/load data for multiple saves using GDE I need to save the gde_data file then create duplicates of said file in the Resources folder with a different name for each save slot I plan on having. When the player needs to load said slot, I would just use the initialize action and call the specific gde_file in order to load the data for that specific slot. Using the Save All action would then only save the data into that particular gde_file. If the player needed to erase a slot, I'd just load initialize that file, then use the Reset All action to reset that file to the default values since those default values are stored and not overwritten during the Save All action.

    Just want to make sure I'm understanding things correctly and I'm going about this the right way. Hopefully that's not a word salad.
     
  23. iamindrajit

    iamindrajit

    Joined:
    Jun 5, 2013
    Posts:
    4
    Hi! Sorry for the late reply. I have tried this but when I click on load data I get this error
    upload_2020-8-19_8-17-12.png
     
  24. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    There is only one runtime save file. You can have multiple primary data sets, but any saves are stored in a single file.
     
  25. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
  26. iamindrajit

    iamindrajit

    Joined:
    Jun 5, 2013
    Posts:
    4
    Thanks for the last patch. But currently, I am facing this strange issue. I have items in a Schema named skills
    upload_2020-9-9_7-35-41.png

    But when I am trying to get the list in scripts I am getting 21 items. The extra Item does not have any name or anything the name is coming as an empty string.
    upload_2020-9-9_7-37-8.png
    upload_2020-9-9_7-37-34.png
    I have attached the screenshots and have sent you the game data file over email.
     

    Attached Files:

  27. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    900
    I bet you have accidentally created them as runtime entries. In the Item Editor, click "Show Runtime Entries" and you'll probably see "21" at the end of the list. It's my only complaint of GDE, that in accessing an item, if it doesn't exist, a new one is created by default. I'd rather have an error telling me it doesn't exist and give me the option to create a new one if that's what I wanted to do. Accessing data is far more common than creating.

    Assuming you are accidentally creating keys at runtime, the trick is to test if the key exists before trying to load it:

    Code (CSharp):
    1. if (GDEDataManager.DataDictionary.ContainsKey(itemKey)) {
    2.        var item = new GDEWhateverSchemaData(itemKey);
    3. }
     
    SwiftIllusion likes this.
  28. Frogames

    Frogames

    Joined:
    Jun 10, 2005
    Posts:
    199
    Hi all. I would like to report a bug of the last version of GDE (2.9) in Unity 2019.4.13f1 LTS.

    When I import spreadsheet from googledrive, GDE is no longer able to load datas.

    To replicate the bug:
    - create a new project in Unity 2019.4.13f1
    - import the last version of GDE
    - load a spreadsheet from googledrive
    - generate GDE data classes
    - hit play

    Here is the error msg:

    System.NullReferenceException: Object reference not set to an instance of an object
    at GameDataEditor.GDEItemManager.LoadSchemas () [0x00078] in B:\TEST_GDE\TEST2\Assets\GameDataEditor\Editor\GDEItemManager.cs:606
    UnityEngine.Debug:LogError(Object)
    GameDataEditor.GDEItemManager:LoadSchemas() (at Assets/GameDataEditor/Editor/GDEItemManager.cs:628)
    GameDataEditor.GDEItemManager:Load(Boolean) (at Assets/GameDataEditor/Editor/GDEItemManager.cs:446)
    GameDataEditor.GDEManagerWindowBase:OnFocus() (at Assets/GameDataEditor/Editor/GDEManagerWindowBase.cs:138)
    UnityEditor.DockArea:OnEnable()

    Any idea?
     
  29. justDeek

    justDeek

    Joined:
    Dec 13, 2016
    Posts:
    12
    @Celestipoo I just noticed a different problem, that might have been there even before the latest update. I recently changed my system region (in windows 10) to Germany and encountered 2 problems regarding google spreadsheets because of it:

    1. floating point numbers now need to be written with a comma instead of a dot (0.1 gets imported as 1, while 0,1 now gets correctly imported as 0.1). This might sound like a desirable outcome, because that's how you'd write it in Germany and other countries, but it threw me off because I'm pretty sure that it hasn't always been that way and I had to adapt myself a long time ago to always use dots instead of commas (not just for GDE but also most international products).
    Also it probably creates an issue with float lists, as you use commas to separate the lists and it will probably interpret the float commas as separators, but I haven't tried it yet.

    2. When importing from or authenticating with google it throws the error "String was not recognized as a valid DateTime". This is because my settings.AccessTokenLastRefreshed is at "10/22/2020 8:49:08 PM" and in Germany the month is at the second place, that's why its now trying to interpret the 22 as a month which is out of bounds. You can easily fix this by adding "CultureInfo.InvariantCulture" as the second parameter to DateTime.Parse(timeString)". So in GDEOAuth.cs at line 162 it should read:
    oauth2Params.AccessTokenRefreshedDate = DateTime.Parse(timeString, System.Globalization.CultureInfo.InvariantCulture);

    This might also be a solution to wherever the floats get parsed in the first problem.

    I'll revert back to United States as my region format in the system settings, but it would be nice, if you could at least fix the second issue, as it probably affects other countries with different date time formats. For the first issue you'd have to decide, whether you want to keep it that way or unify it to the american/british way of writing floats (which I would prefer).
    And if it actually breaks the float lists it might be more of a pressing matter.
     
  30. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    900
  31. justDeek

    justDeek

    Joined:
    Dec 13, 2016
    Posts:
    12
  32. Skyline520

    Skyline520

    Joined:
    Jan 14, 2016
    Posts:
    8
    Hi, I have some problem with changing scenes. Everything is fine if I work in one scene:
    - Check some strings in List<>, then add new strings to List<>. Save. It still works after I play/stop in editor
    When I open other scene through Play mode and back, it doesn't check strings in List<>, yet it can add new strings to the same List<>. I use this in the main scene

    Code (CSharp):
    1. GDEPlayerData myplayer;
    2.  
    3. GDEDataManager.Init("gde_data");
    4. myplayer = new GDEPlayerData (GDEItemKeys.Player_myplayer);
    Is myplayer created over again?
    Edit: I have many scenes, and I do Init GDE some scenes to access save data
     
    Last edited: Dec 6, 2020
  33. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    I'm not sure what you mean when you say it doesn't check the strings in List<>. Do you mean the list is not loaded in some of your scenes?
     
  34. Skyline520

    Skyline520

    Joined:
    Jan 14, 2016
    Posts:
    8
    Thanks for replying. It works again after I did Reimport all things and Clear GDE runtime data
     
  35. StarFluke

    StarFluke

    Joined:
    Jan 19, 2013
    Posts:
    39
    Hi, I love your product! It reminds me of the story that Sid Meier (Civilization) would go on sabbatical for game design and return with a stack of spreadsheets for the next game version.

    One thing I just ran into with GDE is, I had to reduce Managed Stripping Level to Low to get GDEDataManager.GetAllItems<T>() to load in my spreadsheet. At Medium or High Stripping I am getting this exception and stack trace:

    MissingMethodException: Constructor on type 'GameDataEditor.GDERawResourceData' not found.
    at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x001f0] in <3a710699206e46588c84ed4b7454609d>:0
    at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x000a1] in <3a710699206e46588c84ed4b7454609d>:0
    at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <3a710699206e46588c84ed4b7454609d>:0
    at GameDataEditor.GDEDataManager.GetAllItems[T] () [0x00020] in C:\Unity\Lost\Assets\GameDataEditor\APIScripts\GDEDataManager.cs:316
     
  36. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Add the Preserve attribute to any GDE data classes like the example in the Unity docs: https://docs.unity3d.com/Manual/ManagedCodeStripping.html#PreserveAttribute
     
  37. andylewisart

    andylewisart

    Joined:
    Nov 4, 2013
    Posts:
    18
    Hello,
    Is it possible for GDE to import from a spreadsheet during runtime? Or at least on Start? I see this question was asked back in 2015, but was wondering if anything has changed since then. I'm hoping to make a build of my app that can be updated by other non-unity people on the fly via Google Sheets.
    Thanks for any help!
     
    Last edited: Jan 16, 2021
  38. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    No. Spreadsheet import is for development only.
     
  39. tomtominc

    tomtominc

    Joined:
    Nov 7, 2013
    Posts:
    22
    Hey @Celestipoo

    - Using Unity 2020.2.0f1
    - Latest GDE
    - Latest Json Dot Net

    I'm having trouble with my Json Dot Net import and GDE. Json Dot Net is now on 8.0.0.0 and GDE is looking for 6.0.0.0. Before when I had this problem I would just uncheck your Newtonsoft.json.dll plugin from use in the editor and things seemed to work perfectly. Now I'm experiencing errors where GDE is looking for 6.0.0.0 but the only dll is at 8.0. Is there anything that can be done about this?

    I've attached the errors for clarity.
     

    Attached Files:

  40. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Are you using google spreadsheets? That's what the JSON Dot Net is used for. If not, you might be able to remove that functionality from your project as a workaround.
     
  41. tomtominc

    tomtominc

    Joined:
    Nov 7, 2013
    Posts:
    22
    I am using google spreadsheets unfortunately
     
  42. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    I'll need to update the google api and hopefully do away with the JSON.Net dependency. I'll post a fix as soon as I can.
     
  43. tomtominc

    tomtominc

    Joined:
    Nov 7, 2013
    Posts:
    22
    Thank you so much!
     
  44. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Turns out this was already fixed. If you have the latest from the asset store, the only DLL that you should have in the project is EPPlus.dll. Delete any others that are in GameDataEditor/Editor/ExcelImport/Dlls
     
  45. tomtominc

    tomtominc

    Joined:
    Nov 7, 2013
    Posts:
    22
    @Celestipoo

    I get these errors if I delete them.

    GDE 2.9.0

    Also, trying to import this version shows that they are included in the import.
     

    Attached Files:

  46. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    I'm not sure what's happening with your project. But when I import GDE 2.9 I don't get those Dlls.
    Screenshot 2021-02-20 143010.png
     
    Last edited: Feb 20, 2021
  47. Celestipoo

    Celestipoo

    Joined:
    Jul 1, 2013
    Posts:
    379
    Hello All, unfortunately GDE needed to be deprecated. EPPlus is now under a non commercial license which prevents us from using it. Sorry for the inconvenience. GDE had a good long lifespan. Thank you to all who used it!
     
  48. suspect7

    suspect7

    Joined:
    Jan 24, 2016
    Posts:
    5
    Oh no! Sorry to hear it!
     
  49. Frogames

    Frogames

    Joined:
    Jun 10, 2005
    Posts:
    199
    Thank you for your hard work Celeste!
     
  50. Aleksei-Laser

    Aleksei-Laser

    Joined:
    Apr 4, 2014
    Posts:
    7
    Hello. You can use EPPlus 4.5.3.3. It woks in Unity 2022 and has non-commercial license.