- Home /
Question by
willianjohns · Jul 26, 2018 at 03:52 AM ·
problemaregister
Problem for account creation system
I'm trying to create an account creation system within Unity, but I run into the following error:
error CS0246: The type or namespace name Response could not be found. Are you missing an assembly reference?.
Script NetworkConnection:
`public void CreateUser(string userName , string email , string pass , Action<Response> response){
StartCoroutine (Make_CreateUser (userName, email, pass, response));
}
private IEnumerator Make_CreateUser(string userName , string email , string pass , Action<Response> response){
WWWForm form = new WWWForm ();
form.AddField ("userName", userName);
form.AddField ("email", email);
form.AddField ("pass", pass);
WWW w = new WWW ("http://localhost/game/createUser.php", form);
yield return w;
response (JsonUtility.FromJson<Response> (w.text));
}
[Serializable]
public class Response {
public bool done = false;
public string message = "";
}`
MenuController script:
`[SerializeField] private InputField userNameInput = null;
[SerializeField] private InputField emailInput = null;
[SerializeField] private InputField passwordInput = null;
[SerializeField] private InputField RepasswordInput = null;
[SerializeField] private Text textInput = null;
private NetworkConnection s_NetworkConnection = null;
public GameObject Register;
private void Awake(){
s_NetworkConnection = GameObject.FindObjectOfType<NetworkConnection> ();
}
public void SubmitRegister(){
if (userNameInput.text == "" || emailInput.text == "" || passwordInput.text == "" || RepasswordInput.text == "") {
textInput.text = "Please, complete all fields";
return;
}
if (passwordInput.text == RepasswordInput.text) {
textInput.text = "Loading...";
s_NetworkConnection.CreateUser (userNameInput.text, emailInput.text, passwordInput.text, delegate (Response response) {
textInput.text = response.message;
});
} else {
textInput.text = "Passwords are not equals";
}
}
public void OnMouseDown ()
{
Register.SetActive (!Register.activeSelf);
}`
The problem is in the MenuController script in this snippet:
s_NetworkConnection.CreateUser (userNameInput.text, emailInput.text, passwordInput.text, delegate (Response response) {
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612171549im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Allocation Already Register 1 Answer
Punch animation problem 0 Answers
why not activate the program still tried online and offline? 0 Answers
issues with the manual registration process 1 Answer
Storing Transforms On Awake, is this the best way? 2 Answers