public void HandleRegisterClick() { Debug.Log("HandleRegisterClick called!"); AddUser addUser = new AddUser(); //AddUser addUser = this.gameObject.AddComponent<AddUser>(); if (addUser != null) { InputField nameInput = registerUserCanvas.GetComponentInChildren <InputField>(); addUser.AttemptAddNewUser(nameInput.text, RegisterUserCallback); Object.Destroy(registerUserCanvas); } else { Debug.Log("Add user = null"); } // Attempt to add a user // Wait for Response // If succeed, then main menu, else throw error and loop/repeat }