Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //this script has the best english ever Kappa.
- /*
- * the broblem:
- * in the void "SubmitButton" there are 2 lines that set the submit name and password to a string to use in the script but the script is void "LoginButton" dont see the string or don't get that string???
- */
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- using UnityEngine.SceneManagement;
- public class loginScript : MonoBehaviour {
- public Text name;// login tab for username
- public Text pw; // login tab for password
- public Text createName; // create account tab username
- public Text createPw; // create account tab password
- public void SubmitButton()
- {
- string createUsername = createName.text.ToString();
- string createPassword = createPw.text.ToString();
- }
- public void LoginButton()
- {
- string userName = name.text.ToString();
- string password = pw.text.ToString();
- if (string.IsNullOrEmpty(userName)) // check if there is a letter in the textfield
- {
- Debug.Log("ERROR | No content in login or password tab"); //if not this error will log
- }
- // if it has 0 errors this will check if the submited text is the same as the text in the login screen
- else if (userName.Contains(createUsername) && password.Contains(createPassword))
- {
- SceneManager.LoadScene("mainMenu");
- }
- //error message if the username or password is not the same as submitted
- if (userName.Contains(createUsername) && password.Contains(createPassword) == false)
- {
- Debug.Log("ERROR | Wrong username or password");
- }
- }
- public void QuitButton() // quit button
- {
- Application.Quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement