Unity & MySQL Databases, Part 2: Registering Users

preview_player
Показать описание
Add items to your database via C# and PHP code. The first step in building your million-player online game, or setting up a list of data you can access in the cloud.

Support Board to Bits on Patreon:
Рекомендации по теме
Комментарии
Автор

12:08
For those we cannot drag and drop the input field to corresponding c# object...

InputFiled type is now legacy, so either you have to add the legacy inputField using mouse right click>UI>Legacy>Input Field.
Or if u want to use newer InputFiled type of Textmashpro!, then change the code to this:

using TMPro;
public TMP_InputField namefld; // this was previously public InputField namefld;
public TMP_InputField passwdfld;

staynjohnson
Автор

This was a great tutorial. I will add that with the latest version (2020.3.29f1) that I had to make a few changes. One has already been mentioned and wasn't too hard to adjust--using UnityWebRequest in place of WWW. However, another item that caused me trouble for a while was that the Canvas did not automatically add an EventSystem so I had to add that. But you also have to click Add Default Input Modules in order for the UI items to actually work.

meganmoore
Автор

23:07 - I thought programming was friend. I want mommy

johannb.rastarson
Автор

For those who get the error # (no number, just blank)
all you have to do is to go to MAMP settings and change the apache & NGINX port to 80
for some reason, unity detect it as different results than using 8080

azkayasmin
Автор

It works. Make sure in the DB you made score field (is null) . make sure also that you are using mysqli functions not mysql ones..

AbdulkareemAodah
Автор

I am watching this tutorial years later now and most of the scripting code he is using have been deprecated so I hope he finds the time to do this exact same tutorial with UnityWebRequest class instead of WWW class, but still awesome tutorial!

zekariyaszelelew
Автор

This PHP is the worst torture I have ever endured

oscarrodriguezfernandez
Автор

This is actually one of the best tutorials ever seen, good job

highspy
Автор

for those using Text Mesh Pro - Input Field --> make sure to use TMPro using directive and then TMP_InputField (not InputField) variable, otherwise it won't let you assign it in unity. Simple fix but may save someone the trouble down the line :)

BryanLevin-kw
Автор

Please help! I had set up and named everything the same as in the video, but my PHP file does not give anything back. The c# works fine for sure, because if I only write echo("0"); in the PHP, it gives it back, but with all the code in it, just doesn't work. (I checked the spelling many many times.) Btw the error prop says: "500 Internal Server Error" Any idea?

noemisandor
Автор

Great tutorials! Only the WWW is obsolete. I still enjoyed the learning experience, the various different softwares, and the break down explanation step by step. I'm starting to learn about WWWForm and IMultipartFormSection as well as UnityWebRequest in an attempt to repair this code as a fun little project. I would like to see you post a revised video if you care to do so then I'll be glad to click like on that series too!

grandmasterskitz
Автор

Please check PDO and prepared queries, because you're very, very, very vulnerable to SQL injections by passing arguments directly into the query: this is *very* bad practice. You could also use JSON to answer with your script, which would make communicating way easier (passing messages and stuff in a convenient format for Unity to read and decode).

garfunk
Автор

Can you share your code? To make us sure we write code clearly!

artemiosarthur
Автор

I just keep getting the #1 error. It refuses to connect to my data base. I have made and test multiple user accounts. None of them work. Is there anything that would cause this issue besides a database connection error?

deathonadinosaur
Автор

In 22:17 it is not necessary to concatenate since you are using double quotes.

Evangelio-Eterno
Автор

If your game were to be running on a client, is there a way to still connect to this database? Since it’s only a local database, I would think this method would not work for clients

elusiveelephant
Автор

Thank you for these tutorials! Awesome work. I'm now trying to figure out how I would connect to my Bluehost Server MYSQL DB in place of where you connected with MAMP. Any help or advice would be amazing!!!

YUMIEVERYONE
Автор

So, everz time I try to sign in I get an error "User signin failed. Error #<br />
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in on line 6<br />
1: Connection failed"
Despite me not ever defining a password or defining it as "". Any tips?

karmillaschreger
Автор

How many keyboards have you replaced????

johnhouser
Автор

i get this error Assets\Scripts\Registration.cs(23, 23): warning CS0618: 'WWW' is obsolete: 'Use UnityWebRequest, a fully featured replacement which is more efficient and has additional features'

can someone help please :(((

PaulineWolf-nw
visit shbcf.ru