Hi, I'm learning to connect on my database. This is my code : Code (CSharp): using UnityEngine; using System.Collections; using MySql.Data.MySqlClient; public class Connexion : MonoBehaviour { #region Propriétés Publiques public string account; public string password; public GameObject accountInputGO; public GameObject passwordInputGO; #endregion #region Propriétés Privées private string connexionString; private MySqlConnection connexionBDD; private MySqlCommand commandeSQL; private MySqlDataReader lecteurBDD; private bool erreurBDD; private string erreurBDDTexte; #endregion #region Méthodes Unity void Awake() { connexionString = "Server=localhost;Database=****;Uid=****;Pwd=*****"; connexionBDD = new MySqlConnection(connexionString); } void Update() { } #endregion #region Méthodes Autres public void CreationBoutton() { if (accountInputGO.GetComponent<UIInput>().value != "" && passwordInputGO.GetComponent<UIInput>().value != "") { account = accountInputGO.GetComponent<UIInput>().value; password = passwordInputGO.GetComponent<UIInput>().value; CreationCompte(); } } public void CreationCompte() { try { } catch (MySqlException ex) { } } public void VoirCompteBoutton() { } #endregion } // Fin du Script catch (MySqlException ex) make this error : The type caught or thrown must be derived from System.Exception When i try this with classic C# application (without unity), there is no problem When i try with unity, i have this error. MySql.Data.dll (v2.0) is referenced in Unity and Visual studio Could you help me before i become crazy ^^'
You say that this works in a "classic" C# application, but I assume you're not compiling exactly the same code, because I don't think a standalone C# app would like the "using UnityEngine" statement at the top of this file. Maybe there's some other minor difference you're overlooking between the working and non-working versions? Have you tried just copying the entire sourcefile from the working "classic" C# app into Unity, with no modifications at all?