I recently decided to write a plug-in for Unity 3D that can be used for targeting a Windows Store Application. The idea was to have it connect to Windows Azure Mobile Services. There are a couple existing plug-ins that connect to Mobile services, but neither of them supported offline sync yet so I decided to go and write my own. While doing this I ran into the following error when trying to run my game:
‘Microsoft.WindowsAzure.MobileServices.CurrentPlatform’ from assembly ‘Microsoft.WindowsAzure.Mobile.Ext, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null’ is attempting to implement an inaccessible interface.
I was completely confused on what could cause this error. After troubleshooting I found out that when Unity builds out my Windows Store project it will process any files in the Assets\Plugins\Metro directory and re-write some metadata into them. When it re-wrote the Microsoft.WindowsAzure.Mobile.Ext assembly it wrote it out in such a way that it broke strong name signing thus creating the above error.
The solution is to make sure to tell Unity not to process these references. If you are using 3rd party plug-ins make sure to read the documentation on whether or not to add the assembly to the unprocessed list or not. Basically if the unity plug-in does not reference UnityEngine.dll, then it should not be processed by unity.
To add a module to the Unprocessed Plugins list do the following in unity:
- From the File Menu choose Build Settings…
- In the dialog that opens up choose Windows Store Apps and click the Player Settings… button
- In the inspector window expand publish settings
- Under unprocessed plug-ins specify number of modules to add to unprocessed list
- This will display that number of edit boxes. Fill those in with the modules that should not be processed:
I hope this blog is helpful for anyone else running into the error. Until next time, have fun coding!
Don’t forget to follow the Windows Store Developer Solutions team on Twitter @wsdevsol. Comments are welcome, both below and on twitter.
– Bret Bentzinger(Microsoft) @awehellyeah