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

UniDDatabase 2.0

Discussion in 'Made With Unity' started by namoricoo, Jun 3, 2011.

  1. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    I have purchased you db product, and am trying to work with Edy's car physics which I also own, I have tried following your video tut, but when you show the UniDDatabase panel, you already have the CarMotion db open, when I try and open it, I get the following error?

    Could not find a part of the path "C:\Users\gregba\Documents\NewUnityProject2\Assets\UniDDatbase\Resources\DDatabase_Uni\Default_DbExamples\CarMotionAudio.txt"


    Any ideas what I am doing wrong?
     
  2. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    Brother Greg, thanks for the support. I purchased your Array wizard last year and I loved it. The problem is very simple. "\Default_DbExa mples" is not supposed to have a space. it's supposed to be one word.
     
  3. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    For People who updated to Unity 3.4. I noticed 12 warnings and I have fixed those warnings.I will send the update to the Asset store tomorrow. I will Also send code to Allow Adding a field in game view. You will also be able to remove a field in game. I will also try to release a Video.
     
  4. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    hey namoricoo,

    I am interested in this, but I would like to know how good it can work with textassets (is what I need mainly), especially bigger textassets (150+ words). Could you explain how it works and tell me if it would be suitable?
    For now I have 250 different objects which all have a title and a description + 9 different integer values.

    Cheers

    zem
     
  5. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    I'm doing the Texture Asset Test at the moment. They are very good. The Vision is very simple.
    1)open TexturePacker
    2)Import a folder of texture
    3)The Textures should auto arrange
    4)Export As a Json
    5)rename the Json to txt
    6)Import into Unity
    7)At the moment you have to manually put the name of each texture in a cell... For example In you are doing a two state button. On row will have the name of the normal texture, another row will have the name of the highlighted texture, third row will have the primary key.

    So if you have 50 buttons, you'll be able to access all 50 buttons by simply calling the primary key of the button. The same way I call Music in the edy's physics video. Just toggle the number and done.

    I will try to put a video together before the end of the week. It's just beautiful. You won't have to hard code the names the way it's done in the video. code once and done. That's the idea I'm working with so far. Instead of putting the texture itself in the uniDDatabase. You'll put the name of the Texture. I hope that made sense.
     
  6. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    nono I mean text not texture. Should be a difference, shouldn't it?
     
  7. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    oh, sorry for the misunderstanding. It's a simple task.
    1) You open UniDDatabase
    2)Click the new button
    3)Give it a ddatabase name and click create
    4)a new window appears,next give a table name and choose names for the row.(IE you can have one row of text, one row with ID...
    5)hit new.
    6) A new table will be created.
    7)Now this is where the difference will be. When you hit "new record" you are only able to type in the textbox, no copy and past. if I were new I could create all of the rows I wanted here....with a word or two in each cell.
    8)PAY CLOSE ATTENTION!!!!!! After all of your cells have been created. you can click on each cell. The edit window will appear for each cell with a TEXT AREA. In the text area, you are able to copy and past. now you can paste the correct text for each cell. it does not matter how long the text is.

    It's the same number visual logic as my uniSqlite video. Only difference between UniDDatabase and UniSqlite...UniSqlite can have several table in one Database. UniDDatabase only has one table per ddatabase because it's much faster for the gaming environment. UniSqlite is ONLY FOR UNITY PRO. UniDDatabase is for Pro and Indie. These videos are for demonstration purposes only. I can make a quick video illustrating everything I just said if you want.


     
  8. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    that's fine, thank you. I will play with it ... if I can find my credit card ... -.-
     
  9. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    Let me know if you have any other questions. Thank you for the support and have a nice day.
     
    Last edited: Jul 30, 2011
  10. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    I finally broke down and purchased you're product and aware of warnings you have received with Unity 3.4, And look forward to the fix's in the near future.

    receive errors when i attempt too compile runtime SimpleUpdate.cs/ezTextUpdate.unity

    ;)
     
  11. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    hmm now I get it, your rows confused me, because they or vertical.
    usually rows are horizontal and columns are vertical as I know it from rdbms
    so you have no way to get all infos like Id, name, description, field1, fieldx ... with one call, right? I will have to call each of this seperately and then sort it myself, right?

    lets say I have a table pets:

    Id - name - description
    1 - Owl - sort of bird <---- I want all this with one call
     
    Last edited: Jul 31, 2011
  12. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    1) thank you for getting off the fence and stepping into the future. You'll quickly discover that UniDDatabase is the best unity video game data management system. It's not perfect yet. It's getting there. That why the price is still low. UIToolkit, is the best Unity Data presentation system. When you bring them both together. It's magic.

    2)I'm sorry for the delay, I just got off work. I work a 10 hour shift and I can't do non-work related task on company time. However, I did want to answer the question before I went to sleep. Can you please copy and paste the error message so that I can see exactly what's going on. Most common errors, the row numbers are not set correctly, everything else is automated.
    3) The warning are due to a Unity3d release update, if you click on the warning, they will all take you to a line containing "EditorGUILayout.ObjectField" All you have to do is add ",false" before the closing bracket After the "typeof(xxxx)". So you'll have something like "typeof(xxx),false)".
    If you post your reply early enough I'll be able to reply before I go to work.
     
    Last edited: Jul 31, 2011
  13. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    zemog86, you make a valid point. It should have been the other way around, I will update it this week. You can also see another update I've been working on. For when you have a lot of content.
    $Screen shot 2011-07-31 at 2.02.43 AM.png
    I didn't expose a method to ret all three rows at once because you can't combine int,Text,Texttures,Audio,Prefabs, in one variable. The function I use for the editor is available for this tasks. It will will you everything. Gets all of the cell data. So if you have 10 rows, you'll get all 10 rows. or 1 row if you only have one row.

    GUIContent[] listOfCellData=DDatabaseCs.GetCellData();
     
  14. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    Sent you a PM of the editor log.
     
  15. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    yeah thanks,

    I have worked around it myself, its a bit more of a performance hit now, but it should be fine since I only load the data once and it will not be changed during runtime, so I can easily live with the ~80 querys this time. Oh and if you don't mind me asking ... on your screenshot I can see SampleID, what is this for? I mean you already have 0, 1, 2, 3, 4 in the first column, right? So why do you have it twice?
     
    Last edited: Jul 31, 2011
  16. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    The "sample ID" is the Primary Key. The numbers on the left side are row numbers for the user only. They do nothing for the system. you group your data by primary key, not by row number. It's the same logic use in MySql,Sql,Sqlite....You also notice how there is no column Name on top of that.
     
  17. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    hmm looks wierd to me, nvm, can you let me know when you have this update ready and let me know the amount of query's you do to implement it? I have now 3 tables with 8 columns and each of them has 12+ rows in it, so if I do it myself now I'll have atleast 8 query's to do per table
     
  18. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    I don't write the query myself. I just copy and past from the example and change the name to be relevant to what I'm working on at the moment. So you never have to write a new query. You just have to focus on the task you are trying to do.
    2)Having a line number is nothing new. You can activate line numbers in mono, you can't invoke a script with line number in mono. It's there for organization only.
     
  19. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    Unity 3.4 has made several changes. "AssetDatabase.LoadAssetAtPath" is an editor script, work fine when you are working in the editor and it does not appear to run when compiling to a game. The Unity Engineer I talked to advised me to make is work from any directory. I'll have to go back to what I had two months ago when I was using ( Resources.load ). I don't see an AssetDatabase.LoadAssetAtPath equivalent for game mode. I'm working on this at the moment. Pushing hard to get the update out this week. You can have as many Resources folder as you want.
     
    Last edited: Jul 31, 2011
  20. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    I have gotten the scripts to "Build and Run" with no errors. Now I just have to make adapt the algorithm to work with system.IO.Path instead of the Old scripts I used in Unity 3.3. There is a 95% probability we should be able to get this working this week. Now I have to go to work, so I'll start working on this again tomorrow.
     
  21. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    Hey,

    so I've abstracted it a little bit to create a more universal use and be a bit more object oriented:

    Code (csharp):
    1.  
    2.  
    3. using UnityEngine;
    4. using System.Collections;
    5.  
    6. sealed class SqliteController
    7. {
    8.     private static SqliteController _instance;
    9.     private static string path = "/dbFiles/";
    10.     private static string dbBuildingInfo = "BuildingInfo";
    11.  
    12.     private enum OperationType
    13.     {
    14.         All,
    15.         Equals,
    16.         Contains,
    17.         Greater,
    18.         GreaterThanOrEqual,
    19.         LessThan,
    20.         LessThanOrEqual,
    21.         Between
    22.     }
    23.  
    24.     public static SqliteController getInstance
    25.     {
    26.         get { return _instance ?? (_instance = new SqliteController()); }
    27.     }
    28.  
    29.     public Hashtable getAllBuildings()
    30.     {
    31.         // init return table
    32.         Hashtable data = new Hashtable();
    33.  
    34.         // get building info database file
    35.         TextAsset buildingDb = (TextAsset)Resources.Load(path+dbBuildingInfo);
    36.  
    37.         // properties
    38.         string id = "id";
    39.         string name = "name";
    40.         string descr = "description";
    41.  
    42.         // run query for each column and add data to hashtable
    43.         int[] ids = UniDDatabaseCs.GetArrayOfInt(buildingDb, id);
    44.         string[] names = UniDDatabaseCs.GetArrayOfText(buildingDb, name);
    45.         string[] descriptions = UniDDatabaseCs.GetArrayOfText(buildingDb, descr);
    46.         // all other data ....
    47.        
    48.         foreach(int item in ids)
    49.         {
    50.             Hashtable newObj = new Hashtable();
    51.             newObj.Add(id, item);
    52.             newObj.Add(name, names[item]);
    53.             newObj.Add(description, descriptions[item]);
    54.             // all other data ....
    55.            
    56.             data.Add(item, newObj);
    57.         }
    58.        
    59.         // return data
    60.         return data;
    61.     }
    62. }
    63.  
    64.  
    65.  
    I have not tested this as I am not at my computer at the moment, but it should work fine this way.
    I will add a bit more abstraction during the week.
     
    Last edited: Jul 31, 2011
  22. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    You can PM me any progress. I tried to keep the code simple for non-advanced programers. The hash table functionality has been on my todo list for a couple of weeks now. If your results are great. I'll roll it out with the next update cycle. I have to go to work now.
     
  23. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    sure I will fletch it out a bit more, do you know any way to get the column names for a table?
    Something like getAllColumnNames(mydatabase) would be great
     
  24. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    GUIContent listOfColumnNames=DDatabaseCs.GetListOfRowNames();

    Still have to update the names.
     
  25. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    Alright I will take a look at it when I get home. Thanks so far, I will let you know if I get trouble
     
  26. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    I fixed the script and now it's able to build and Run. I still have more testing to run. I'm hopping to have to update out no later than Thursday.
     
  27. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    Today I'm finalizing the update and I'll be testing it on multiple platforms.
     
  28. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    By tomorrow, the update should be up live in the AssetStore.
     
  29. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    Just waiting for the update to get approved by the Asset Store....
     
  30. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    there's an update there now. However, it's not the final update... Three functions are not complete. "EzPrefabUpdate" and "EzTextureAndSoundUpdate". I'm waiting for the Asset Store to release the new update.... When the new update gets release I'll post a message here.
     
  31. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    Here are some sample in game screen shots. I'll have a video up by tomorrow. You can see the script working in both iPhone and a stand-Alone. Tomorrow I will test my script on my Windows computer.

    $Screen shot 2011-08-05 at 10.40.43 PM.png $Screen shot 2011-08-05 at 10.42.26 PM.png $Screen shot 2011-08-05 at 10.25.20 PM.png $Screen shot 2011-08-05 at 10.25.11 PM.png
     
  32. impudicus

    impudicus

    Joined:
    Mar 30, 2010
    Posts:
    1
    I have some questions regarding data size limitations.

    I see that in your video(s) each data element is presented in the inspector [Element 0; Element 1; etc... ]
    That seems to work great for a relatively small array, but what if I have a database with THOUSANDS of entries?
    Let's say I'm making a word-guessing game... I require a database of thousands of words with which one might guess from. Have you tested the responsiveness of the editor when dealing with large data sets?

    Second question... How do I get my information in the UniDDatabase? Can one import from an xml or csv file, or the like into the database, or must one input all informations anew using the in-editor interface?

    Thanks for the info.
     
  33. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    I don't know what the upper limit is. If you are only dealing with text.You would be able to manage more content than if you are dealing with pictures and sound.The only thing you would have to do is load the Text in a hash table. Set the word as the key. set a number as the index. If it returns more than -1, the number is in the hash table. Otherwise it's not in the hash table. The only place you would take a penalty hit is when you are loading the ddatabase in the start.
     
  34. sebako

    sebako

    Joined:
    Jun 27, 2009
    Posts:
    301
    yeah you will want to load only portions that you need, I can't think of any case where I would load 200+ elements at the same time and even that is already a lot.
     
  35. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    He can have more than 200 Text Files at once. One thousand text files is still easy to search... If each one is unique. If I were making that game I would probably use a dictionary instead of a hash table. Check out this link. HashTable Vs Dictionary...

    http://msdn.microsoft.com/en-us/library/4yh14awz.aspx

    The key take away

    "The Dictionary<TKey, TValue> and ConcurrentDictionary<TKey, TValue>classes have the same functionality as the Hashtable class. A Dictionary<TKey, TValue> of a specific type (other than Object) provides better performance than a Hashtable for value types."
     
    Last edited: Aug 7, 2011
  36. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    The latest Update should be in the Asset store tomorrow. Asset Store made a mistake when I submitted the last update. They went to an earlier version of my code.
     
  37. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    Uniddatabase 2.431

    I have the uniddatabse working on Win7 64 bit just moments ago.

    The problem is with this file CollisionAudio_UniDDatabase.cs which i removed
    CarMotionAudio_UniDDatabase.cs and this removed.

    okay after some testing of EZTextUpdate i noticed the path is wrong to the database.txt
    I change this to my location and it is still not working.

    <fileGps>/Users/napoleonk/Documents/Unity/UniDDatabase2_0/Assets//////////////UniDDatbase/Resources/DDatabase_Uni/Default_DbExamples/TextAndID.txt</fileGps>
    @_[_@ TextAndID.txt @_]_@


    Did you hurry because this is sloppy.
     
    Last edited: Aug 9, 2011
  38. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534

    You are testing this no Windows...It works with no errors on Mac. Here try this. Open TextAndID.txt in the Editor, click on a file and hit update, save, it should update the path to be relative to your project. it's odd that you're the only one having problems. I will investigate this on my PC. I had a Unity Eng look at it and test it. He did not have any problems. That why he updated the product at the store.
     
    Last edited: Aug 9, 2011
  39. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    I add the CollisionAudio_UniDDatabase.cs, CarMotionAudio_UniDDatabase.cs after I ran the last tests. At the top of those files you have to make sure the following code is not present.

    using UnityEditor;

    I apologize for not re-testing after adding those last two files. Now I'm moving over to A PC and re-testing All of the examples. I hope to have any PC related bugs fixed no latter than tomorrow.
     
  40. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    I tested all of the slideshowExamples. I got No errors. When I tested all of the update example I only found one error. EZtextupdate. It's update both the first and lastName with the same name. We are fixing that at the moment. I'm still on a Mac. Now I will move over to a PC and Build and Run as PC stand-Alone.
     
  41. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    I still had Unity 3.3 on my PC. I have to upgrade to Unity 3.4.



    I'm importing the UniDDatabase Package now in order to see if I can isolate any PC related problems.
    I got a big truck number of errors when I open the Unity 3.4 compatible scrips in Unity 3.3. So the first thing that needs to be done. People need to make sure they have Unity 3.4
     
    Last edited: Aug 9, 2011
  42. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    okay had no effect on the fileGps path

    Its acting hardwire to you're pc and not flushing the path somewhere perhaps in here?

    UniDDatabaseCs.cs
     
  43. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    When I removed all of the scripts that relate only to Unity 3.4. I'm able to get all of the slideshow examples to work. However, The Editor does have a windows path error and the update examples don't work. After I finish upgrading to Unity 3.4 for Windows, we should have no problem resolving these minor problems.
     
  44. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    Brother runner, if you try to Build and run the slideshow examples as stand-Alone Pc. They should all work. I have isolated the path error script. I should have this resolved after I upgrade to Unity 3.4 for PC. Thanks again for pointing out the errors.
     
  45. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    It's not hard coded to my computer like you think. When the file gets opened on any computer, it will automatically identify it's own location. The key word here is open. In order to work correctly. none of the files or paths should have spaces in them. In windows for example "Document And Settings" for example have space, several paths have spaces in the file name. That's the only reason it's not opening for you at the moment. That's why I call it "the space bug".
     
  46. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    Public_Uniddatabase_CS/UniDdatabseCs.cs

    Line:238 - ConvertMacPathToWindowsPath were does this start its offensive on pc's and you want to replace it with application.Datapath + "/databases/"; as a example

    Code (csharp):
    1.     public static string CreateDDatabaseInDirectory(string defaultDirectory,TextAsset ddatabase)
    2.     {
    3.         defaultDirectory=defaultDirectory+"/"+ddatabase.name+".txt";
    4.         string path="";
    5.         if( Application.platform == RuntimePlatform.WindowsPlayer)
    6.         {
    7.             path=ConvertMacPathToWindowsPath(defaultDirectory);
    8.         }    
    9.         else
    10.         {
    11.             path=defaultDirectory;                    
    12.         }
    nvm found the function right under my nose " ConvertMacPathToWindowsPath"

    static public string ConvertMacPathToWindowsPath(string macPath)

    okay were is - macPath -
     
    Last edited: Aug 9, 2011
  47. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    The problem is "the space bug". If you build and run Any of the slideshow scripts on windows as a PC stand-Alone, you will see everything works fine. The only reason the update functions are not working and the editor is not opening any of the file is because of "the space bug." I will have it fixed by tomorrow. I will spend the entire day tomorrow working on it. Just try to build and Run as Pc stand Alone if you are using unity 3.4 and let me know if you get any errors. I get no errors. I open up the folder and I see the ddatabase just fine in the UniDDatabase folder that gets created in the
    " defaultDirectory". if you look at the fileGPS there, you'll see the correct fileGPs for the stand-alone. You should notice words with spaces. Example on my Pc I have windows XP, the path shows up as C:\Documents and Settings\...etc That's the only reason it's not opening those two spaces between Documents and Settings. if it was DocumentsandSettings, you would not have noticed any problems. i will fix this soon.
     
    Last edited: Aug 9, 2011
  48. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    They are PC Stand alone builds just so you know ;)
     
  49. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    once again, I'm sorry for the mistake. I should have it resolved by tomorrow.
     
  50. namoricoo

    namoricoo

    Joined:
    Apr 14, 2011
    Posts:
    534
    Just submitted UniDDatabase 2.5 to the AssetStore, And EzTextUpdate has also been fixed. All known issues have been resolved on Mac And PC. Now I will start working on better documentation and new videos.