I am currently using a .txt file with each line meaning a different thing (ID, NAME, DESC, STATS)
then writing each line of the text file to an array like this when the game starts
qdb = questDatabaseDoc.text.Split(“\n”[0]);
I then search each line of the array until dbArray == ID when I want to search for an item or quest it then writes x no of lines below to another array
javascript*_</em> <em><em>*function findItem(ID: int){ for( var i : int = 0; i< qdb.Length; i++ ) { // Debug.Log(db); if(qdb == id){ Debug.Log("QUEST FOUND"); questID = parseInt(qdb[i+0]); questName = qdb[i+1]; questDesc = qdb[i+2]; questLevel = parseInt(qdb[i+3]); questRewardGold = parseInt(qdb[i+4]); questRewardExp = parseInt(qdb[i+5]); // = Resources.Load(qdb[i+4], GameObject); icon = Resources.Load(qdb[i+6], Sprite); }}}*</em></em> <em>_*
But how big can these DBArrays be before it starts to effect performance?
My weapons/armor DB is about 800 lines which is creating an array 800 lines long.
Is there a way to just read each line of the txt file without having to make a huge array?
When searching for an item it starts to lag as the game has to run through every line to find the correct ID
I have separate managers for quests/inventory/loot/equipment all variations of the above.
Are their any tricks that you use to speed up the search?