- Home /
Load entire table from MySQL
Looking to load in base property prices for all of the properties in my game. When a user starts the game it will load up the prices for each individual property from the mysql database.
I know I could do this by loading each individual field from the table and assigning them to the property as a variable but is there any quick way to load it all in as a full table array and assign it to all of the objects in the game at once. Currently in my testing map there is only 20 properties but will be upwards of 200 later so will be a long method doing each property.
Also I am better with C# then I am with JS if thats any help.
Also if it is possible what would be the best way to give each house in the game an ID so that it can match up with the database and automatically fill with the data?
Answer by Sandstorm · Nov 06, 2013 at 07:16 AM
I currently do it by loading a JSON formatted string. I encode it in PHP and decode it in unity.
PHP has a build-in JSON encoder + decoder, and its fairly easy to find one for unity, there's a whole bunch of them out there! :)
Your answer
Follow this Question
Related Questions
Is it possible to send a table name through a wwwform and use it in a php query? 0 Answers
MySQL and PHP Question 1 Answer
Saving/Loading variables 1 Answer
Proplem with loaddata from php 0 Answers
How to get WebGL PlayerPref values out of Indexeddb? 0 Answers