Up until now I have been doing everything in the editor, writing my book with instructions and packages to go along with it, when I got a text come across my blackberry about MySQL having issues when building to deploy. Up until then I had not heard of anyone having issues, then I figured I would simply build and deploy a package to see what on earth is going on when to my surprise Unity decided that MySQL is not supported… seriously??? WTF! It works just FINE in the editor, when I build it up and make sure the DLL’s are in the build folder, here is the error:
Ok, let me state this as loud and as clear as humanly possible, NOT supporting a library just because it is not in your managed code list to support is down right wrong, U3 is so locked down that if my code represented someone eating at a fine diner then got up to go to the bathroom, U3 would tell them that they are not allowed to pee.
I submitted it as a bug but seriously, I have ran into SOOOOOOOOOOOO many “not supported” with Unity that I am about to puke.
WHY are you jacking up so many things that you are slapping our hands for using external libraries???
Seriously
I hope this is not the standalone windows / osx build as it is getting rather annoying that main frameworks are not correctly transfered nor the builder actually picking up framework dependencies correctly (it does it neither in the additional path nor does the striper on mobile pick them up correctly for getting rid of frameworks)
I understand that it would not work in webplayer but there basically cause mysql will never work anyway due to its dependence on the unmanaged mysql dll
the error thrown there is a thing thta I’ve seen regularly on 2.x due to the outdated mono and encoding 1292 just not existing on it, didn’t expect to see that ever again with U3 though as the upgraded mono was meant to fix exactly this kind of problems
Hello Minevr, this is not web player, this is windows stand alone build and I copied the DLL’s I am using from the Assets folder into the Managed folder after trying it with the standard DLL’s included with Unity build, so it simply does not work in stand alone build.
thats incorrect
it can not use unmanaged DLLs, thats not remotely the same thing as external libraries normally (in this case it would be due to the dependency on mysql.dll but this is an exception)
I guess you are not getting it Minevr, It works FINE in the editor, I am talking about “BUILD” then after you build it up, running it. You have to COPY the LIBRARIES that you use, in my case, System.Data.dll, System.Drawing.dll, and MySql.Data.dll to the game folder of Demo_Data\Managed since my program is called Demo, so that means that my files are Demo.exe in the game folder and it makes a folder called Demo_Data and in that folder is a Managed folder where I put all managed libraries.
Thanks for the info, but I am writing a book on this subject.
It is the dependency on MySql.Data.dll that U3 does not support
That part though isn’t new … just never got looked at.
I hope it will though as the striper for mobile isn’t able to pickup dependencies resonably at all with U3 so the “not picking up dependencies” suffers into both the add and remove way right now.
the add one though can at least be cured through manual copy or a simple postprocessscript, at least in some cases one should say
The file exists, it is not supported. There is a difference between missing library and not supported library, they simply do not support the use of it. Which chapter 2 of my book is based on MySQL. Everything I am doing, screen shots and instruction are all based on the editor, I took for granted that what works in the editor flawlessly would work in a solid build but platform dependent. Stinks that I am 6 chapters in to find this out now.
Oh that is something which iOS developers learnt the very ugly way with Unity iPhone 1.x already …
had a fully working JSON based dynamic filling of data till the point of deploy back then … required over 10 hours to find a working json library and implement it again (the last one remaining, jsonfx, worked)
Its sad that the U3 editor is still lacking though the editor emulation of the restrictions is more solid than U2 and Unity iPhone 1.x I’ve to say. its not fine but a step forward which with the complexity isn’t a trivial thing.
But I agree that it is definitely a problem if such stuff happens and to me its even more a problem cause UT artificially crippled framework support in U3 that worked totally fine on U2 and/or Unity iPhone 1.x already on .NET 1.x
Best example for this is the tickout of 3rd party assemblies especially on the webplayer. Its near impossible to go any more paranoid and restrictive there without preventing system, system.text or system.xml from working at all
This is definately the .NET 2.0 Framework version of the MySQL data libarary. There is a difference in the editor binary and the build translator. I can only assume that the game binary that is built is using some older code that the Editor has fixes for in it. The thing is, they should mirror each other in what they work with. The MySQL data library that I am using works just fine with other .Net 2.0 built programs with the framework targeted as .Net 2.0, it is only U3 that is giving me the unsupported message. This can’t be a mono issue because the Editor is using the same version of Mono that the build uses, so something isn’t fixed in the build that is fixed in the Editor. Besides, switching the editor to use the full .Net vs the Subset makes no difference in the error when I build it, same error, unsupported.
That error is thrown in my Awake() which is creating a new instance of the MySQL object, I know exactly what line it is on. It is not allowed to create the object, that is what is not supported.
The error states, that a codepage ist not supported: System.NotSupportedException: CodePage 1252 not supported
The same error has been discovered in Linux-Ubuntu using Mono with MySQL. There they fixed it, with making the codepage available, Which is possible with the I18N Libraries.
So, on Mac, make the Resources of the Unity Editor App visible: Go to /Contents/Frameworks/Mono/lib/2.0/ and copy the 6 dlls that start with I18N to the Managed Folder of your built game.
On Windows, go to
\Unity\Editor\Data\Frameworks\Mono.framework and copy the 6 dlls that start with I18N to the Managed Folder of your built game.
Alternatively, you cn copy those Files to your Assets Folder of the Project using MySQL… Tried that too, just because I try to avoid too much work in the build… (I have a Project that needs three different Builds. Would be too much work to copy for each build.)
Actually you are mostly right, create a “Plugins” folder, place all the libraries needed for MySQL to work into that folder including the following to make MySQL work (only tested on Windows at the moment, won’t have time until this weekend to test on my Mac)
With those all in your Plugins folder, in theory, it should work. It works right now on my laptop, I haven’t bothered to deploy to web build yet, Mac or other devices.
It being a deployment bug, not a mono bug, Mono has it fixed in the I18N.West.dll library, Unity does not deploy all Mono libraries in the Mono folder, luckly founderio stumbled across this, I will be updating my documentation, but this is not something that will work in anything but either a Windows build and probably a Mac build. It will not work for Andriod (tried) or iPhone (again, tried), nor will it work for Web (tried that also 8p) sadly it is only something for a fat client.