- Home /
Best way to set up a city trading system script?,Best way to script city trading system?
Hi Everyone, I have been working on a city trading system and wondering if there is a more efficient way to do it. The concept is each cities prices are randomized for each product, so you can buy low and sell high. At the moment I have just chucked everything into integers on one script, but if I want to add a new product I am copying and pasting and changing the name of each int or method. So I am wondering if there is a more efficient way. I looked into scriptable objects, but can't see how that will work. Sorry for the noob question, I have searched high and low and cannot find an answer! Thanks for your time!,
Answer by mihoci10 · Mar 04, 2019 at 08:11 AM
If you could add some examples of your i could be more specific, but you could make a struct, which is basically a class that cant have functions on it just variables. And then define on it variables like id, name, price. Then you can create a list on each city that can contain this new struct type and each item in list can have specific values of variables on it. Thats all i can help you with for now as i dont have any idea as to how you have been solving issues until now. Hope it helps
Your answer
![](https://koobas.hobune.stream/wayback/20220612192857im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to get a variable from a triggers script. 0 Answers
define touch area 2 Answers
Need help writing script 1 Answer
Dont know what im doing wrong?(Error included) (Javascipt) 0 Answers
how to restart a game 0 Answers