So in the game I’m getting item names from a database and finding the right object with that name, to do that I’ve thought of two options:
1)Putting every item in an array and searching in that array the name I got from internet REST API, which means going through 1000 items (In blueprint),
2)By using findObject in C++, find the object by the string I’ve taken from the database,
Question is: Is going through 1000 items in an array expensive, or creating that array, be it an array of strings or objects? Which method do you think is less expensive? Is there a better way to do this?
Definetly do not search for every object in the scene. Creating an array with reference to your objects seem a good way to go. 1000 isnt that much to go throught, to be safe, do it in C++ and you’ll get a nice perf boost.
Yes I have that index unless the player leaves the game. When he leaves and say comes back tomorrow, I have to get the items from the database, I’m getting the items’ names as strings from the database, and I have to find the actual items by looking at those names. Anyone can help with that? Or I’ll have to go through 1500 array.