Hi Everyone,
I have been looking for this information for far longer than I wish to admit. I can not for the life of me seem to find any information regarding saving player state. Here is what I want to do:
I have a player prefab that is spawned in (not part of the scene originally) This is handled by none other than photon networking.
What I want to be able to do at the very least, is simple save the player’s position to some form of online database. This way they can access it from other PC’s as well as save progress. I can not find any information regarding how to hook up a database for storing this information.
Long story short, When the player prefab is created I want it saved, everything on the prefab remains intact and loads when the player comes back to play.
AT the very least i want to save the player position.
I want this saved to a server, not on the player’s client to avoid cheating and allow log in from other places.
Any ideas? Can someone point me in the right direction?
See if this video is any help.
Kinda gives me an idea, Will this work in unity though? Do not see him even mention unity.
You should be able to import the dll’s into your project and use them with unity.
Depends what version of the .net runtime the dlls for that database are compiled in. If they are compiled for any version greater then like 3.5 then it won’t work.
Pretty much what you want to do is have the Server Control all movement. The Server would then be the one to connect to the Database and save the information. You NEVER want the Client to connect directly to the Database.
Yeah I have heard not to allow the client to connect directly, Are the DLLS located in the unity install folder? At this point I just want to save some simple values (player XYZ and money to name two)
You can use WWW class to write/read data at any time you wish to an online database, simple calling a server side script, for example PHP to write/read to MySQL.
Hmm yeah that is true, I think I will look up how to generally access database info with PHP/C# then figure out how to get unity to be happy with it.