Sending a request for data from within Unity
Posted: 11 Sep 2010, 00:55
Hello. I've made it quite far without having to ask any questions, but after a few nights of research I'm at a loss.
I'm using Unity3D, and am building off the Islands Demo.
I have sfs installed and running.
I have mysql installed and running.
I created a database and a table named USERS.
All I would like to be able to do (at this point) is be able to read a value from the mysql database from within Unity3d.
For example, when a player presses the 'G' key, I would like to get the record count of the table USERS. Something fairly easy.
I read Chapter 8 of the sfs docs and understand what I need to do. My problem is implementing it on the client side in Unity3d.
What I've tried to do is detect for the key press, and then execute this command:
smartFox.sendXtMessage(extensionName, "getData", {}, "xml");
Then of course I would modify this command to take the appropriate actions:
smartfox.onExtensionResponse = function(resObj:Object, type:String)
{
...
}
Do I need to write the script in C# or JavaScript?
If someone can help me out with this, then the sky's the limit.
All I'm looking for is a simple nudge in the right direction.
Thanks,
Kelly
Kingston, Ontario
I'm using Unity3D, and am building off the Islands Demo.
I have sfs installed and running.
I have mysql installed and running.
I created a database and a table named USERS.
All I would like to be able to do (at this point) is be able to read a value from the mysql database from within Unity3d.
For example, when a player presses the 'G' key, I would like to get the record count of the table USERS. Something fairly easy.
I read Chapter 8 of the sfs docs and understand what I need to do. My problem is implementing it on the client side in Unity3d.
What I've tried to do is detect for the key press, and then execute this command:
smartFox.sendXtMessage(extensionName, "getData", {}, "xml");
Then of course I would modify this command to take the appropriate actions:
smartfox.onExtensionResponse = function(resObj:Object, type:String)
{
...
}
Do I need to write the script in C# or JavaScript?
If someone can help me out with this, then the sky's the limit.
All I'm looking for is a simple nudge in the right direction.
Thanks,
Kelly
Kingston, Ontario