Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Need Help with reconnecting Database

Discussion in 'Multiplayer' started by Jackk_, Nov 13, 2017.

  1. Jackk_

    Jackk_

    Joined:
    May 2, 2017
    Posts:
    49
    Basically the problem that I am having is that I used to be able to add users to my database but after changing modifying some of the code involved, I have lost the ability to input data into the database but I can still retrieve and connect with the mySQL Database. I am going to include as much data as I possibly can, in the hopes that you might be able to solve the issue that I'm having as I am relatively new to networking and I don't understand what has went wrong. I have been following Yasil's tutorials to get this far, and in particular the videos that I have followed since the database was working in sync, were video 1 and video 2.

    DarkRift = The free asset that I have been using to allow me to host a server that acts as the middleman between the database and the unity engine.

    How I know I can still retrieve data from the mySQL Database? Basically, my game has a login screen, which can be seen in this screenshot, to the left of it is the DarkRiftServer, and to the right is the mySQL database, which you can see has a user called 'noog' which i attempt to login with


    After clicking the 'Login' button, located at the bottom left of my login screen, You can see from the screenshot below on the DarkRift logs that I successfully log in to the Database, by comparing the credentials with those stored in the database, and I am then redirected to the 'Build Char' scene.



    How do I know that I can't add new information to the database? The Login screen also has a 'Add User' button. This button is used to add a new account using usernames that aren't yet stored on the database, This feature evidently worked previously as there are 5 accounts registered in the database, and no new ones are being added. So somehow during the process of modifying the code, I can't seem to add new accounts to the database, but the function still appears in the logs 'Data: Sender: 1 DistributionType: Server Tag-Subject:10-3' which relates to the Y-Const file where you can see that distribution type 10-3 involves adding a user to the database.
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3.  
    4.  
    5. namespace Yasil
    6. {
    7.     //
    8.     // Dark Rift Transport Tags
    9.     //
    10.     public class NT
    11.     {
    12.         public const byte LoginT = 10;
    13.  
    14.         public class LoginS
    15.         {
    16.  
    17.             public const ushort loginUser = 1;
    18.             public const ushort logoutUser = 2;
    19.             public const ushort addUser = 3;
    20.             public const ushort loginUserSuccess = 4;
    21.             public const ushort loginUserFailed = 5;
    22.             public const ushort logoutSuccess = 6;
    23.             public const ushort addUserSuccess = 7;
    24.             public const ushort addUserFailed = 8;
    25.  
    26.         }
    27.  
    28.  
    29.     }
    30. }
    Image before pressing Add User with a new username that has not yet been used

    Image after pressing Add User with a new username that has not yet been used: Note that no new user has been added to the database, yet the logs seem to attempt to do so, and also the user isn't redirected to the 'BuildChar' scene.



    This leads me to believe that the source of the issue is not due to the:

    mySQLDatabase: As I haven't changed anything in mySQLWorkbench since it was able to function correctly.
    The UI in Unity: As I haven't changed anything involving that since it was able to function correctly.
    Y-Const file: As I haven't changed anything involving that since it was able to function correctly.

    Which means that the only source of the problem could be to do with DarkRift or the three files that I modified since the database could communicate correctly between DarkRift and mySQL.

    The three .cs files that I modified

    First File: LoginManager.cs

    Login Manager, Is essentially a .dll file that helps tell the logs what to say if something happen, as long as the main links to the database in my eyes, lines 199-219 I would guess to be the root of the problem on this file. *Also lines 250-275 seem relevant*
    Code (CSharp):
    1. using DarkRift;
    2. using DarkRift.ConfigTools;
    3. using DarkRift.Storage;
    4. using System;
    5. using System.Collections.Generic;
    6.  
    7.  
    8. namespace LoginPlugin
    9. {
    10.     public class LoginPlugin : Plugin
    11.     {
    12.  
    13.         /// <summary> Plugin Description
    14.         ///
    15.         /// </summary>
    16.  
    17.         public override string name { get { return "LoginPlugin"; } }
    18.         public override string version { get { return "1.0"; } }
    19.    
    20.         public override Command[] commands
    21.         {
    22.             get
    23.             {
    24.                 return new Command[]
    25.                 {
    26.                     new Command("UserCreate","Turns ON and Off User Creation [on/off]", new Action<string[]>(UserCreateCommand)),
    27.                     new Command("AddUser", "Adds a User to the DB [AddUser name password]", new Action<string[]>(AddUserCommand)),
    28.                     new Command("LPDebug", "Turns on Plugin Debug", new Action<string[]>(DebugCommand))
    29.                 };
    30.             }
    31.         }
    32.  
    33.         public override string author { get { return "Original from Jack Fisher"; } }
    34.         public override string supportEmail { get { return "@hotmail.com"; } }
    35.  
    36.         /// <summary> All Variables we are going to read out of the config file
    37.         /// </summary>
    38.  
    39.         private ConfigReader _settings;
    40.  
    41.         private byte _loginT;
    42.         private ushort _loginSUserLogin;
    43.         private ushort _loginSLogoutUser;
    44.         private ushort _loginSAddUser;
    45.         private ushort _loginSLoginSuccess;
    46.         private ushort _loginSLogoutSuccess;
    47.         private ushort _loginSLoginFailed;
    48.         private ushort _loginSAddUserSuccess;
    49.         private ushort _loginSAddUserFailed;
    50.  
    51.         private bool _allowAddUser = false;
    52.         private bool _debug = false;
    53.  
    54.         private object _obj;
    55.  
    56.         private int _reason;
    57.  
    58.         public LoginPlugin()
    59.         {
    60.  
    61.             /// <summary> If not installed Make Plugin under ./Plugins/Pluginname, Also Create the Database Table for this...
    62.             /// </summary>
    63.             if (!IsInstalled())
    64.             {
    65.                 InstallSubdirectory(
    66.                     new Dictionary<string, byte[]>()
    67.                     {
    68.                         {"settings.cnf", System.Text.ASCIIEncoding.ASCII.GetBytes("LoginTag:\t\t\t\t\t10\n"+
    69.                                                                                    "LoginSubjectUserLogin:\t\t1\n"+
    70.                                                                                    "LoginSubjectLogoutUser:\t\t2\n"+
    71.                                                                                    "LoginSubjectAddUser:\t\t3\n"+
    72.                                                                                    "LoginSubjectLoginSuccess:\t\t4\n"+
    73.                                                                                    "LoginSubjectLoginFailed:\t\t5\n"+
    74.                                                                                    "LoginSubjectLogoutSuccess:\t\t6\n"+
    75.                                                                                    "LoginSubjectAddUserSuccess:\t\t7\n"+
    76.                                                                                    "LoginSubjectAddUserFailed:\t\t8\n"+
    77.                                                                                    "AllowAddUser:\t\t\tTrue\n"+
    78.                                                                                    "Debug:\t\t\t\t\t\tTrue")}
    79.                       }
    80.                 );
    81.                 try
    82.                 {
    83.                     DarkRiftServer.database.ExecuteNonQuery(
    84.                         "CREATE TABLE IF NOT EXISTS tblPlayer(" +
    85.                         "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, " +
    86.                         "username VARCHAR(50) NOT NULL, " +
    87.                         "password VARCHAR(256) NOT NULL ) ", new QueryParameter[0]
    88.                     );
    89.                 }
    90.                 catch (DatabaseException e)
    91.                 {
    92.                     Interface.LogError("[LoginPlugin] SQL error during setup" + e.ToString());
    93.  
    94.                     if (_debug)
    95.                         Interface.Log("[LoginPlugin] SQL error during setup");
    96.  
    97.                 }
    98.             }
    99.  
    100.             /// <summary>
    101.             ///  Read Settings from settings.cnf
    102.             /// </summary>
    103.  
    104.             _settings = new ConfigReader(GetSubdirectory() + "/settings.cnf");
    105.  
    106.             /// <summary>
    107.             ///  Read Variables
    108.             /// </summary>
    109.  
    110.             if (!byte.TryParse(_settings["LoginTag"], out _loginT))
    111.             {
    112.                 Interface.LogFatal("[LoginPlugin] Plugin Tag could not be found in settings.cnf");
    113.                 DarkRiftServer.Close(true);
    114.             }
    115.             if (!ushort.TryParse(_settings["LoginSubjectUserLogin"], out _loginSUserLogin))
    116.             {
    117.                 Interface.LogFatal("[LoginPlugin] User Login Subject could not be found in settings.cnf");
    118.                 DarkRiftServer.Close(true);
    119.             }
    120.             if (!ushort.TryParse(_settings["LoginSubjectLogoutUser"], out _loginSLogoutUser))
    121.             {
    122.                 Interface.LogFatal("[LoginPlugin] User Logout Subject could not be found in settings.cnf");
    123.                 DarkRiftServer.Close(true);
    124.             }
    125.             if (!ushort.TryParse(_settings["LoginSubjectAddUser"], out _loginSAddUser))
    126.             {
    127.                 Interface.LogFatal("[LoginPlugin] Add User Subject could not be found in settings.cnf");
    128.                 DarkRiftServer.Close(true);
    129.             }
    130.             if (!ushort.TryParse(_settings["LoginSubjectLoginSuccess"], out _loginSLoginSuccess))
    131.             {
    132.                 Interface.LogFatal("[LoginPlugin] User Login Success Subject could not be found in settings.cnf");
    133.                 DarkRiftServer.Close(true);
    134.             }
    135.             if (!ushort.TryParse(_settings["LoginSubjectLoginFailed"], out _loginSLoginFailed))
    136.             {
    137.                 Interface.LogFatal("[LoginPlugin] User Login Failed Subject could not be found in settings.cnf");
    138.                 DarkRiftServer.Close(true);
    139.             }
    140.             if (!ushort.TryParse(_settings["LoginSubjectLogoutSuccess"], out _loginSLogoutSuccess))
    141.             {
    142.                 Interface.LogFatal("[LoginPlugin] User Logout Success Subject could not be found in settings.cnf");
    143.                 DarkRiftServer.Close(true);
    144.             }
    145.             if (!ushort.TryParse(_settings["LoginSubjectAddUserSuccess"], out _loginSAddUserSuccess))
    146.             {
    147.                 Interface.LogFatal("[LoginPlugin] Add User Success Subject could not be found in settings.cnf");
    148.                 DarkRiftServer.Close(true);
    149.             }
    150.             if (!ushort.TryParse(_settings["LoginSubjectAddUserFailed"], out _loginSAddUserFailed))
    151.             {
    152.                 Interface.LogFatal("[LoginPlugin] Add User Failed Subject could not be found in settings.cnf");
    153.                 DarkRiftServer.Close(true);
    154.             }
    155.             if (!bool.TryParse(_settings["AllowAddUser"], out _allowAddUser))
    156.             {
    157.                 Interface.LogFatal("[LoginPlugin] Allow Add USer could not be found in settings.cnf");
    158.                 DarkRiftServer.Close(true);
    159.             }
    160.             if (!bool.TryParse(_settings["Debug"], out _debug))
    161.             {
    162.                 Interface.LogFatal("[LoginPlugin] DEBUG could not be found in settings.cnf");
    163.                 DarkRiftServer.Close(true);
    164.             }
    165.    
    166.  
    167.             /// <summary>
    168.             ///  Add us to the Server Message Event
    169.             /// </summary>
    170.  
    171.             ConnectionService.onServerMessage += OnServerMessage;
    172.         }
    173.  
    174.         private void OnServerMessage(ConnectionService con, DarkRift.NetworkMessage data)
    175.         {
    176.             if (data.tag == _loginT)
    177.             {
    178.                 /// Did we get an User Login Message?
    179.                 if (data.subject == _loginSUserLogin)
    180.                 {
    181.                     #region Login
    182.  
    183.                     bool isloggedin = false;
    184.                     if (con.HasData(name, "IsLoggedIn"))
    185.                         isloggedin = (bool)con.GetData(name, "IsLoggedIn");
    186.  
    187.                     if (!isloggedin)
    188.                     {
    189.  
    190.  
    191.                         try
    192.                         {
    193.                             using (DarkRiftReader reader = (DarkRiftReader)data.data)
    194.                             {
    195.                                 string _username = reader.ReadString();
    196.                                 string _password = reader.ReadString();
    197.  
    198.                                 DatabaseRow[] rows = DarkRiftServer.database.ExecuteQuery(
    199.                                     "SELECT id FROM tblPlayer WHERE username = @username AND password = @password LIMIT 1 ",
    200.                                     new QueryParameter("username", _username),
    201.                                     new QueryParameter("password", _password)
    202.                                 );
    203.                                 if (rows.Length == 1)
    204.                                 {
    205.                                     bool _hasuma = false;
    206.                                     int id = Convert.ToInt32(rows[0]["id"]);
    207.  
    208.                                     con.SetData(name, "IsLoggedIn", true);
    209.                                     con.SetData(name, "UserID", id);
    210.                                     DarkRiftWriter writer = new DarkRiftWriter();
    211.  
    212.                                     writer.Write(_hasuma);
    213.                                     writer.Write(id);
    214.  
    215.                                     con.SendReply(_loginT, _loginSLoginSuccess, writer);
    216.  
    217.                                     if (_debug)
    218.                                         Interface.Log("[LoginPlugin] Successful login (" + id + ").");
    219.  
    220.                                 }
    221.                                 else
    222.                                 {
    223.                                     if (_debug)
    224.                                         Interface.Log("[LoginPlugin] User" + _username + " could not login");
    225.                                     _reason = 0;
    226.                                     con.SendReply(_loginT, _loginSLoginFailed, _reason);
    227.                                 }
    228.                             }
    229.                         }
    230.                         catch (InvalidCastException)
    231.                         {
    232.                             if (_debug)
    233.                                 Interface.Log("[LoginPlugin] Invalid data recieved in a Login request.");
    234.                             _reason = -1;
    235.                             con.SendReply(_loginT, _loginSLoginFailed, _reason);
    236.                         }
    237.  
    238.                         #endregion Login
    239.                     }
    240.                     /// Did we get an User Logout Message?
    241.                     if (data.subject == _loginSLogoutUser)
    242.                     {
    243.                         Interface.Log("Logout");
    244.                     }
    245.                     /// Did we get an Add User Message?
    246.                     if (data.subject == _loginSAddUser)
    247.                     {
    248.                         #region AddUser
    249.  
    250.                         if (_allowAddUser)
    251.                         {
    252.                             try
    253.                             {
    254.                                 using (DarkRiftReader reader = (DarkRiftReader)data.data)
    255.                                 {
    256.                                     string _username = reader.ReadString();
    257.                                     string _password = reader.ReadString();
    258.  
    259.                                     if (!CheckUser(_username, _password))
    260.                                     {
    261.                                         AddUser(_username, _password);
    262.                                     }
    263.                                     _reason = 1;
    264.                                     con.SendReply(_loginT, _loginSAddUserSuccess, _reason);
    265.                                 }
    266.                             }
    267.                             catch (InvalidCastException)
    268.                             {
    269.                                 if (_debug)
    270.                                     Interface.Log("[LoginPlugin] Add user failed. Invalid data recieved. ");
    271.                                 _reason = -1;
    272.                                 con.SendReply(_loginT, _loginSAddUserFailed, _reason);
    273.                             }
    274.                         }
    275.  
    276.                         #endregion AddUser
    277.                     }
    278.                 }
    279.             }
    280.         }
    281.    
    282.  
    283.         private void UserCreateCommand(String[] _commadStr)
    284.         {
    285.             if (_commadStr.Length != 1)
    286.             {
    287.                 LogColor("You need to call this command with [User Create on] or [UserCreate off]", ConsoleColor.DarkMagenta);
    288.                 return;
    289.             }
    290.             if (_commadStr[0] == "on")
    291.             {
    292.                 this._allowAddUser = true;
    293.                 LogColor("Add User Creation is" + _commadStr[0], ConsoleColor.Yellow);
    294.             }
    295.             else if (_commadStr[0] == "off")
    296.             {
    297.                 this._allowAddUser = false;
    298.                 LogColor("Add user creation is" + _commadStr[0], ConsoleColor.Yellow);
    299.             }
    300.         }
    301.  
    302.         private void AddUserCommand(String[] _commandStr)
    303.         {
    304.             if (_commandStr.Length != 2) return;
    305.  
    306.             string _username = _commandStr[0];
    307.             string _password = HashHelper.ReturnHash(_commandStr[1], HashType.SHA256);
    308.  
    309.             if (!CheckUser(_username, _password))
    310.             {
    311.                 AddUser(_username, _password);
    312.             }
    313.         }
    314.  
    315.         private void AddUser(String _username, String _password)
    316.         {
    317.             try
    318.             {
    319.                 DarkRiftServer.database.ExecuteNonQuery(
    320.                     "INSERT INTO tblPlayer(username, password) VALUES(@username, @password)",
    321.                     new QueryParameter("username", _username),
    322.                     new QueryParameter("password", _password)
    323.                 );
    324.                 if (_debug)
    325.                     Interface.Log("[LoginPlugin] New User : " + _username);
    326.             }
    327.             catch (DatabaseException e)
    328.             {
    329.                 if (_debug)
    330.                 {
    331.                     Interface.Log("[LoginPlugin] Add user failed.\n" + e.ToString());
    332.                 }
    333.             }
    334.         }
    335.  
    336.         private void DebugCommand(String[] _commandStr)
    337.         {
    338.             _debug = !_debug;
    339.             Interface.Log("[LoginDebug] Debug is " + _debug);
    340.         }
    341.  
    342.         private bool CheckUser(String _username, String _password)
    343.         {
    344.             try
    345.             {
    346.                 _obj = DarkRiftServer.database.ExecuteScalar(
    347.                     "SELECT EXISTS(SELECT 1 FROM  tblPlayer WHERE username = @username ) ",
    348.                     new QueryParameter("username", _username)
    349.                 );
    350.                 return Convert.ToBoolean(_obj);
    351.             }
    352.             catch (DatabaseException e)
    353.             {
    354.                 if (_debug)
    355.                 {
    356.                     Interface.Log("[LoginPlugin] Add user failed." + e.ToString());
    357.                 }
    358.                 return true;
    359.             }
    360.         }
    361.  
    362.         private void LogColor(String _text, ConsoleColor _color)
    363.         {
    364.             Console.ForegroundColor = _color;
    365.             Interface.Log(_text);
    366.             Console.ForegroundColor = ConsoleColor.White;
    367.         }
    368.     }
    369. }
    370.  
    Second File: LoginManager.cs
    The LoginManager file seems to be similar to the first as there is reference to 'SendToServer' at line 46 so I think there could possibly be an issue there
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using DarkRift;
    4. using Yasil;
    5.  
    6.  
    7. namespace Yasil.Login
    8. {
    9.     public class LoginManager : MonoBehaviour
    10.     {
    11.  
    12.         public static int userID{ private set; get; }
    13.         public static bool isLoggedIn{ private set; get; }
    14.  
    15.         public delegate void SuccessfulLoginEventHandler(int userID, bool hasuma);
    16.         public delegate void FailedLoginEvenHandler(int reason);
    17.         public delegate void SuccessfulAddUserEventHandler();
    18.         public delegate void FailedAddUserEventHandler();
    19.  
    20.         public static event SuccessfulLoginEventHandler onSuccessfulLogin;
    21.         public static event FailedLoginEvenHandler onFailedLogin;
    22.         public static event SuccessfulAddUserEventHandler onSuccessfulAddUser;
    23.         public static event FailedAddUserEventHandler onFailedAddUser;
    24.  
    25.         public static HashType myHashType = HashType.SHA256;
    26.  
    27.  
    28.         public static void Login(string _username, string _password)
    29.         {
    30.             if (string.IsNullOrEmpty(_username) || string.IsNullOrEmpty(_password)) return;
    31.  
    32.             using (DarkRiftWriter writer = new DarkRiftWriter())
    33.             {
    34.                 writer.Write(_username);
    35.                 writer.Write(HashHelper.ReturnHash(_password,myHashType));
    36.                 SendToServer(NT.LoginT, NT.LoginS.loginUser, writer);
    37.             }
    38.         }
    39.  
    40.         public static void AddUser(string _username, string _password)
    41.         {
    42.             using (DarkRiftWriter writer = new DarkRiftWriter())
    43.             {
    44.                 writer.Write(_username);
    45.                 writer.Write(HashHelper.ReturnHash(_password,myHashType));
    46.                 SendToServer(NT.LoginT, NT.LoginS.addUser, writer);
    47.             }
    48.         }
    49.  
    50.         static void SendToServer(byte tag, ushort subject, object data)
    51.         {
    52.             if (DarkRiftAPI.isConnected)
    53.             {
    54.                 DarkRiftAPI.SendMessageToServer(tag, subject, data);
    55.             }
    56.             else
    57.             {
    58.                 //Called if you try to login whilst not connected to a server
    59.                 Debug.LogError("[Yasil Login] You can't add a user if you're not connected to a server!");
    60.  
    61.             }
    62.             BindToOnDataEvent();
    63.         }
    64.  
    65.         static void OnDataHandler(byte _loginT, ushort _loginS, object data)
    66.         {
    67.             if( _loginT == NT.LoginT )
    68.             {
    69.                 #region Login Failed
    70.                 if (_loginS == NT.LoginS.loginUserFailed)
    71.                 {
    72.                     int _reason = (int)data;
    73.                     if (onFailedLogin != null)
    74.                         onFailedLogin(_reason);
    75.                 }
    76.                 #endregion
    77.  
    78.                 #region AddUser Success
    79.                 if (_loginS == NT.LoginS.addUserSuccess)
    80.                 {
    81.                     if (onSuccessfulAddUser != null)
    82.                         onSuccessfulAddUser();
    83.                 }
    84.                 #endregion
    85.  
    86.                 #region AddUser Failed
    87.                 if (_loginS == NT.LoginS.addUserFailed)
    88.                 {
    89.                     if( onFailedAddUser != null)
    90.                         onFailedAddUser();
    91.                 }
    92.  
    93.  
    94.  
    95.                 #endregion
    96.  
    97.  
    98.                 #region Login Success
    99.  
    100.  
    101.                 if ( _loginS == NT.LoginS.loginUserSuccess )
    102.                 {
    103.                     bool _hasuma;
    104.                     DarkRiftReader reader = (DarkRiftReader)data;
    105.  
    106.                     _hasuma = reader.ReadBoolean();
    107.                     userID = reader.ReadInt32();
    108.  
    109.                     isLoggedIn = true;
    110.  
    111.                     if (onSuccessfulLogin != null)
    112.                         onSuccessfulLogin(userID, _hasuma);
    113.                 }
    114.             }
    115.         }
    116.         #endregion
    117.  
    118.         static void BindToOnDataEvent()
    119.         {
    120.             if( DarkRiftAPI.isConnected )
    121.             {
    122.                 DarkRiftAPI.onData -= OnDataHandler;
    123.                 DarkRiftAPI.onData += OnDataHandler;
    124.             }
    125.         }
    126.  
    127.  
    128. }
    129. }

    Third File: Login.cs

    This is the third file I changed, simply adding the SceneManager at the bottom few lines to allow the scenes to be switched based on which button is pressed on the UI i.e pressing the Login button should switch scenes to "BuildChar"

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.SceneManagement;
    4. #if UNITY_EDITOR
    5. using UnityEditor;
    6. #endif
    7. using System.Collections;
    8. using DarkRift;
    9. using Yasil.Login;
    10.  
    11.  
    12.  
    13. public class Login : MonoBehaviour {
    14.  
    15.     public InputField UsernameInput;
    16.     public InputField PasswordInput;
    17.  
    18.     void Start ()
    19.     {
    20.         LoginManager.onSuccessfulLogin += ChangeToFirstLevel;
    21.         LoginManager.onFailedLogin += LoginFailed;
    22.         LoginManager.onSuccessfulAddUser += ButtonLogin;
    23.         LoginManager.onFailedAddUser += ButtonQuit;
    24.     }
    25.  
    26.     void OnApplicationQuit ()
    27.     {
    28.         LoginManager.onSuccessfulLogin -= ChangeToFirstLevel;
    29.         LoginManager.onFailedLogin -= LoginFailed;
    30.         LoginManager.onSuccessfulAddUser -= ButtonLogin;
    31.         LoginManager.onFailedAddUser -= ButtonQuit;
    32.     }
    33.  
    34.     public void ButtonLogin()
    35.     {
    36.         LoginManager.Login(UsernameInput.text, PasswordInput.text);
    37.     }
    38.  
    39.  
    40.     public void ButtonAddUser()
    41.     {
    42.         LoginManager.AddUser(UsernameInput.text, PasswordInput.text);
    43.     }
    44.  
    45.  
    46.  
    47.     public void ButtonQuit()
    48.     {
    49.         Application.Quit();
    50.  
    51. #if UNITY_EDITOR
    52.         EditorApplication.isPlaying = false;
    53. #endif
    54.     }
    55.  
    56.     public void LoginFailed(int _reason)
    57.     {
    58.         if (_reason == 0)
    59.         {
    60.             PasswordInput.text = "";
    61.         }
    62.         else
    63.         {
    64.             ButtonQuit();
    65.         }
    66.     }
    67.  
    68.  
    69.  
    70.     public void ChangeToFirstLevel(int _playerID, bool _hasuma)
    71.     {
    72.         if (!_hasuma)
    73.         SceneManager.LoadScene("BuildChar");
    74.         else
    75.         SceneManager.LoadScene("Start");
    76.     }
    77.  
    78. }
    79.  


    More information:

    The files inside my server folder
    /Server2

    /Server/2/Lib

    /Server2/Plugin Source

    /Server2/PluginSource/MySQLConnector

    /Server2/PluginSource/MySQLConnector/bin/Debug

    /Server2/PluginSource/LoginPlugin

    /Server2/PluginSource/LoginPlugin/LoginPlugin/bin/Debug

    /Server2/Plugins

    A possible issue might be the fact that there are 3 Transmission.dll files across the server folder which I could imagine causing some communication errors between the database and the server.

    Please feel to ask me if you need anymore information to solve this issue that I'm having as I have tried contacting Yasil (the author of the tutorials) and he isn't replying. I'd be extremely grateful :)