Making a long list of products with unity
Hello all,
I'm making a virtual supermarket for my masters degree, and inside I have approximately 300 products. My goal is that when the user is choosing a product, at the end, I'll get a UI with all the product that was chosen.
I found this tutorial about creating an inventory UI, but would like to ask, how would you approach this? What is the best way to list 300 products? With array or string (I'm also quite new to scripting but that's what I saw people talk about regarding lists)? I have tutorials explaining to me about the UI inventory, and they're all good,but the thing is they have only 4 or 5 items.
Thanks!
You probably want to find any undergrad ComSci major.
Unity is programmed in C#, which is a cross between Java and C++. $$anonymous$$aking a list is either an array or LinkedList (both standard program$$anonymous$$g things any CS Sophomore would know.) Likewise having each entry be product name and several other stats is a simple class - also something most Sophomores know pretty well.
Displaying it is a separate issue. But I'd imagine the same motivated undergrad could figure it out from an example (tell them to just look at the display part. Their own program$$anonymous$$g is probably better than in the example.)
Answer by TheDarkVoice · May 24, 2020 at 05:27 PM
300 elements is a rather small number. You can easily use an array. As an example, you can have an array for even more than 10000 elements without having any problems. I came here looking for a question I already knew the answer to.