I’m testing the cloud build for the first time and in the beta site it shows WebGL as a target. When I set up my project to build using Windows 64 bit or 32 bit, the small project builds without issue. Using the WebGL or the default WebPlayer I get an error:
[Unity] ArgumentException: The Assembly WindowsBase is referenced by MongoDB.Bson (‘Assets/MongoDB.Bson.dll’). But the dll is not allowed to be included or could not be found.
[Unity] Error building Player: Extracting referenced dlls failed.
[Unity] Player export failed. Reason: Error building Player: Extracting referenced dlls failed.
! build of ‘default-web’ failed. compile failed
I’m just including a Mongo DB driver to make some remote db calls, it works when I hit play locally (and build locally)
I made sure the global .gitignore comments out the DLL line to include in my Repo. After checking manually, my repository and branch contains the dll’s in the Lib folder (otherwise the PC versions wouldn’t compile either). __Read here __if interested.
Not sure if this would go in the Libs folder, Plugins folder or even in the main Assets folder, but I’ve tried all three and same results (PC compiles, no WebGL or Web Player).
I read on this post about enabling in the Editor a “useEmbeddedResources” boolean. Not sure if it’s still the case that this is disabled by default, but I added the flag to my build (I think!) and still no dice.
Likely it’s just a user error, or might be cloud build beta but, but I also tried with the default Web Player on the non-beta site (error above is from that attempt). Thanks for any ideas on getting build to work.
BTW, very happy cloud build can target other platforms now, especially WebGL but trying to work out the kinks before building a very complex one. Thanks!
Can you link which driver exactly you are using? I’m assuming the latest linked here?
Based on that error, my assumption is that the dll relies on windows specific assemblies which aren’t available when compiling from WebGL. Have you actually tried making a build for WebGL locally (rather than just hitting play)?
Originally I downloaded the drivers from this previous post. The code compiled for WebGL locally, however I just noticed that my simple call to the database to read and write something does not work locally from my browser (not sure if a bug or just a symptom of the problem here).
I wasn’t able to pull down the latest version you link to using nuget as the package is targeting .Net 4.5 and the target framework in the Visual Studio IDE is Unity 3.5 .net full base class libraries. I was able to copy the files from the .nuget folder (or manually download the mongo for this driver from here and the BSON driver from here). Unfortunately now my code wont compile locally and reverting to the older dll’s now crash the unity editor locally.
Thanks for any guidance, will be trying to restore system to state where I can compile locally.
OK, so started over re-importing the mongo drivers. Problem seems that the latest drivers are built for 4.5 framework and importing into Unity 5 crashed the editor. Do I need to recompile the source code for Mongo for Unity framework 3.5?
If I just use the compiled drivers found in previous post, I can get the code to compile locally for WebGL, unfortunately none of the actual calls to my database are working…
Honestly I’m not really sure about the state of those mongodb drivers - doing a bit of searching it doesn’t look promising.
Have you considered just writing a wrapper to interact with the mongodb server directly using the WWW class (which should be supported across platforms)?
That’s a great suggestion, that way it doesn’t matter what I use for database just need to create the node.js server and it can read and write. Are there any good examples on the tutorials page or one you’ve seen that’s particularly good? Doesn’t have to be Mongo just trying to get a sense of the classes and implementation (trying not to reinvent the wheel). Thanks again!
Not sure exactly which kind of tutorials you are looking for, but I’m guessing if you search around for REST api tutorials/examples in unity you will find something useful.
Also, if you look at the examples on the WWWForm docs page, you can see how to perform POST requests properly. Then it should be as “simple” as setting up your server to accept those POST requests and writing to the db.