Search code examples
nhibernateunity-game-enginemonocompiled

NHibernate over Mono in Unity3d, connection string problems


I'm using NHibernate in Unity, and running the project in the debug environment works great, but when running the compiled EXE, I was getting a NullReferenceException when trying to access the database.

After much research, I was able to run the following:

Debug.LogError(db.Access.mrefSession.Connection.ConnectionString);

When running in the editor, I get a nice connection string in the console:

Data Source=localhost;Initial Catalog=TheDB;User ID=yy;Password=xxxx

When running the compiled EXE, however, this property is null.

What am I missing?


Solution

  • After some violent trial and error, I was able to get this to work. The solution is deceptively simple: I18N.dll and I18N.West.dll are missing from the standard player. I copied them from the Unity Editor folder (C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0) into the project's Assets\Plugins folder, and everything worked.

    I got the hint for this here: http://answers.unity3d.com/questions/42955/codepage-1252-not-supported-works-in-editor-but-no.html