- Home /
Sqlite in Unity
Here's my code working fine. Only problem I'm facing is that when I'm logged in it won't load my level. Here's my code. public void Loginfunc() { string usernameforsignin = UsernameSignin.text; string passwordforsingin = PasswordSignin.text;
if (usernameforsignin == "sdsefa" || passwordforsingin == "sefse") {
//think what to do here like prompt a form or something
ShowFullName.text="Love";
}
else {
string sqlitequery = "SELECT FullName,Wins,Loss FROM `Player` WHERE Username='{0}' AND Password ='{1}'";
sqlitequery = string.Format (sqlitequery, usernameforsignin, passwordforsingin);
string conn = "Data Source=C://Users//Usman//Desktop//GameProject10.07//Assets//DatabaseLove";
IDbConnection dbconn;
dbconn = (IDbConnection) new SqliteConnection(conn);
dbconn.Open();
IDbCommand dbcmd = dbconn.CreateCommand();
dbcmd.CommandText = sqlitequery;
IDataReader reader = dbcmd.ExecuteReader();
if(reader.Read() == true)
{
isSignin=true;
SignInCanvas.enabled=false;
MainMenuCanvas.enabled=true;
ShowFullName.text= reader.GetString(0);
TotalWinsData.text = reader.GetInt16(1).ToString();
TotalLossedData.text = reader.GetInt16(2).ToString();
PlayerStats.enabled=true;
}
else
{
TotalWinsData.text="MAera ";
}
reader.Close();
dbconn.Close();
}
}
When I'm logged In I click on the Start Button.Coding of start buttons is. public void StartGame() { ShowFullName.text= "I'm there";
Application.LoadLevel (1);
}
It shows the ShowFullName value but gets stuck on the Apllication.laodlevel (1);. What should I do? Before the login game starts without any problem what should I do now?
Your answer
Follow this Question
Related Questions
how to create table in GUI unity? 2 Answers
SQLite unhandler exception 1 Answer
VR Highscore with database (SQLite) 1 Answer
Database (SQLite) Setup for Unity 0 Answers
Backend database and user management 1 Answer