Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
arwe2793

unity cs and xml database quostion

Question

hey guys, i trying to make shop for my game with xml, right now i hawe working database...

the isue i need put all shop item by hand and set its value inside hierarchy script, if i hawe hundresds of items, each item hawe 11 diferent variables as stats, its litle bit time consuming :D. i need that program would it self find all objects and put it to list, then get all values (int's and float's) from xml file and attack it to list.

 

Please login or register to see this code.

as you can see itemenry class is item stats that will be in list.

itemdatabase class is list it slef, i can put items as gameobjects but that prompts error. (i did that in end of the script  with foreach x.x)

 

how to get all objects from hierarchy and stats then put everything to damn list :d thank you

 

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

oh yah i tried list.count++; so its make emty list objects for each item with emty stats , but thats didnt work either :/ if this method would be worked i just needed to get stats from DB or item script

Share this post


Link to post
Share on other sites
  • 0

i dont quite get what you want, are you wishing to load item list from xml to the game? are your items seperate gameobjects?

I would approach it that way:

Load xml data
Run through loop of xml data and create a object for each item, attach script to the instantiated object and attach the item attributes to the instantiated objects component inside loop from xml line.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×