You cannot use Universal Windows Platform specific plugins in Unity Editor if you use Windows Runtime APIs (http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx), so we changed a bit how Unity Editor handles them. If you intend to use the plugin only for Universal Windows Platform and not in Unity editor, you can skip making a placeholder. If you do this, you need to wrap the code which uses the plugin API with the following:
#if !UNITY_EDITOR
// Plugin code
#endif
Si usted necesita un placeholder (marcador de posición), cree dos versiones de plugins:
Importante El plugin placerholder (marcador de posición) para el Editor de Unity no puede referenciar UnityEditor.dll, de lo contrario obtendrá el siguiente error:
The Assembly UnityEditor is referenced by Plugin ('Assets/Plugins/Plugin.dll'). But the dll is not allowed to be included or could not be found.
Both of them must share the same name and have the same assembly version. For example, you should place Editor compatible plugin in Assets\Plugins\MyPlugin.dll, and Universal Windows Platform specific plugin in Assets\Plugins\WSA\MyPlugin.dll.
Go to Assets\Plugins\MyPlugin.dll, select Editor as the only compatible platform
Go to Assets\Plugins\WSA\MyPlugin.dll, select Universal Windows Platform as the only compatible platform, now go to Universal Windows Platform plugin settings
Pick ‘Assets\Plugins\MyPlugin.dll’ in the placeholder field, this means that when building to Universal Windows Platform ‘Assets\Plugins\MyPlugin.dll’ will be used when compiling your scripts, but ‘Assets\Plugins\WSA\MyPlugin.dll’ will be copied to final folder instead of ‘Assets\Plugins\MyPlugin.dll’. This achieves two things - Unity Editor will successfully compile your scripts, but during the game you’ll be using API from Universal Windows Platform specific plugin.
Opción Don’t process
Esta opción se utiliza cuando usted no quiere que Unity parche sus assemblies, usualmente esta opción se debería aplicar para los plugins que contienen un alto uso del Windows Runtime API, y Unity falla en parcharlas.
Propiedad: | Función: |
---|---|
CPU | limita el plugin a players 32 bit, 64 bit o ARM |
Don’t process | (Solamente aplica para managed assemblies) Desactiva el patching (parcheo) para esta assembly. El patching se necesita cuando las assemblies contienen clases serializables por Unity. En estos casos, un código IL adicional se inyecta a las assemblies. Si usted está seguro que las assemblies no tienen tales clases, entonces es seguro desactivar el patching. Nota: si la assembly no está patched, y Unity intenta serializarla en tiempo de ejecución, usted obtendrá un error ‘Out of bounds’ u otro similar. |
Placeholder | (Only applies for managed assemblies). With Universal Windows Platform you can have plugins compiled against .NET Core, but because the Unity Editor runs on Mono, it will fail to recognize such assemblies. As a result, C# or JS files won’t be able to reference them. To overcome this, you have to provide an assembly compiled against .NET 3.5 with identical API which would act as a placeholder for the real plugin. |
Por ejemplo, digamos que usted tiene dos assemblies:
Plugins\WSA\MyPlugin.dll - assembly compiled against .NET Core with Windows Runtime API inside.
Plugins\MyPlugin.dll - assembly compiled against .NET 3.5 which has identical public API with dummy function implementations.
Click on Plugins\WSA\MyPlugin.dll, select Placeholder and pick Plugins\MyPlugin.dll.
This way when Unity compile scripts it will reference Plugins\MyPlugin.dll file, but when Unity will copy plugins to final directory, it will copy Plugins\WSA\MyPlugin.dll instead of Plugins\MyPlugin.dll.
Unity inyecta código de serialización a sus assemblies, significando que si usted tiene una clase derivada de MonoBehaviour en su plugin, y Unity no lo patch, podría obtener un error de serialización durante el tiempo de ejecución.
Both of them must share the same name. For example, you should place an Editor compatible plugin at Assets\Plugins\MyPlugin.dll, and a Universal Windows Platform specific plugin at Assets\Plugins\WSA\MyPlugin.dll. When you’re working in Editor the Assets\Plugins\MyPlugin.dll will be used, and when you’re building to a Universal Windows Platform app the Assets\Plugins\WSA\MyPlugin.dll will copied over to the build.
• 2017–05–16 Page amended with no editorial review