![]() The focus of Unity lies in the development of both 3D and 2D games and interactive content. Unity was released by Unity Technologies in 2005. String responseText = if (responseText.StartsWith("Success"))įorm.Unity is an engine for creating games on multiple platforms. If (GUILayout.Button("Login", GUILayout.Width(125)))įorm.AddField("username", registerUsername) įorm.AddField("password1", registerPassword1) įorm.AddField("password2", registerPassword2) GUILayout.Label("Already have an account?") RegisterPassword2 = GUILayout.PasswordField(registerPassword2, '*', 19) RegisterPassword1 = GUILayout.PasswordField(registerPassword1, '*', 19) RegisterUsername = GUILayout.TextField(registerUsername, 20) RegisterEmail = GUILayout.TextField(registerEmail, 254) ![]() If (GUILayout.Button("Register", GUILayout.Width(125))) If (GUILayout.Button("Submit", GUILayout.Width(85))) LoginPassword = GUILayout.PasswordField(loginPassword, '*') LoginEmail = GUILayout.TextField(loginEmail) GUILayout.Label("Registration Completed!") GUI.Label(new Rect(5, 5, 500, 25), "Status: " + (isLoggedIn ? "Logged-in Username: " + userName + " Email: " + userEmail : "Logged-out")) GUI.Window(0, new Rect(Screen.width / 2 - 125, Screen.height / 2 - 165, 250, 330), RegisterWindow, "Register") If (currentWindow = CurrentWindow.Register) String rootURL = "" //Path where php files are located Public CurrentWindow currentWindow = CurrentWindow.Login If(strlen($username) > $usernameMaxLength || strlen($username) $passwordMaxLength || strlen($password1) prepare("SELECT username, email FROM sc_users WHERE email = ? OR username = ? LIMIT 1")) $errors = "Email is too long, must be equal or under ". This file will receive post data from Unity and insert a new user record into a database table. Replace DATABASE_USER, USER_PASSWORD, and DATABASE_NAME with your values. The first file is database.php which will connect to MySQL database using PHP MySQLi extension. Server-side logic will consist of PHP scripts that will receive and process the Post data from Unity. The query above will create a new table 'sc_users' which will store the user data. MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1 `registration_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP `password` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, ![]() `email` varchar(254) CHARACTER SET utf8 NOT NULL, `username` varchar(20) CHARACTER SET utf8 NOT NULL, Paste the code below into the query editor then click "Go".Click on the newly created database then click on the SQL tab. ![]() ![]() Click on "phpMyAdmin" under DATABASES section.MySQL table will store the values provided by the users, such as username, email, password, etc. The most common are DELETE, SELECT, INSERT, and UPDATE: Only select the privileges that you are planning to use in the future. Under the "Add User To Database" section select the newly created user and database then click "Add"Īfter clicking "Add" you will be presented with a list of Privileges.Lastly, we need to assign a user to a database with a specific set of permissions. Don't forget to save the password somewhere, it will be needed later. Type Username under the "MySQL Users" section then type the password (or preferably use the Password Generator to generate a strong password).Under the "Create New Database" section type the name for your database then click "Create Database"Īfter the database is created we need to create a user that will be associated with it:.Click on MySQL Databases in the DATABASES section.This tutorial requires a server with cPanel along with PHP and MySQLi (improved version of MySQL).ĭo not have a server yet? Feel free to check the affordable premium hosting by Liquid Web or a cheaper alternative here. In this tutorial, I will be showing how to create a login system in Unity using PHP and MySQL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |