Connecting with a database

Hello, I wish to connect with a database with unity for things such as a username and password and character info but I want to know if there is already a tutorial on how to do this. Do you do it as if you do it with php? And will I need to use c# or can I use javascript.

Any help would be nice. :slight_smile: ty

you don’t want to connect to a database directly but to a php that does the connection, otherwise your database must be globally accessable.
communication to php then would happen through WWW

and you can do that with C# or UnityScript

That or simply use Unity Networking to handle the game calls. After the client connects, have it send a request to the server for user information from the supplied character login information. Rather simple really. An entire game can be housed in a database and all assets streamed to a thin client, all through networking. Depends on how complicated you need it to be, if it is simple, use the WWW class, if it is complex, use networking.

I will try out the Unity Networking and see how that works out. I dont know c# so ill see what I can do but I do know PHP and SQL so I dont think it will be much difficulty.

WWW says I can only POST and GET? Cant I CREATE or UPDATE?
I saw that unity can connect with javascript in a website. Could I send info to Javascript in the website from Unity and transfer the Javascript to PHP. Or is there an easier way?

As the others said, use the WWW Class to POST (or GET) data to a PHP script on a webserver that will e.g UPDATE your database.

–
oxl

Nevermind I understand it all thank you.