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
// プラグインコード
# endif
プレースホルダーが必要な場合は、2 種類のプラグインを作ります。
重要 Unity エディターのプレースホルダープラグインは、UnityEditor.dll を参照できません。そうでない場合は、以下のエラーが表示されます。
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.
Assets\Plugins\MyPlugin.dll に移動し、互換性のある唯一のプラットフォームにエディター を選択します
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.
Don’t process オプション
このオプションは Unity にアセンブリのパッチを行ってほしくない場合に使用します。通常このオプションはプラグインが多量の Windows Runtime API を使用していたり、Unity がパッチに失敗するような場合に適用します。
プロパティー | 説明 |
---|---|
CPU | プラグインを 32 bit、64 bit あるいは ARM プレイヤーで制限する。 |
Don’t process | (マネージド アセンブリのみに適用) このアセンブリへのパッチを無効にします。パッチはアセンブリが Unity によってシリアライズ可能なクラスを含む場合に必要です。このケースでは、追加の IL コードがアセンブリに注入されます。もしアセンブリがそういったクラスを持たないとわかっている場合、パッチを無効にしても安全です。注意: もしアセンブリにパッチが適用されてない状態で Unity が実行時にシリアライズを試みた場合は、‘Out of bounds’ エラーかそれに近いエラーが発生します。 |
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. |
例えば、次のような 2 つのアセンブリがあるとします。
Plugins\WSA\MyPlugin.dll - Windows ランタイム API を内部で使用している .NET Core 用にコンパイルされたアセンブリ。
Plugins\MyPlugin.dll - ダミーの関数を実装してまったく同一の public API を持つ .NET 3.5 用にコンパイルされたアセンブリ。
Plugins\WSA\MyPlugin.dll をクリックし、Placeholder から Plugins\MyPlugin.dll を選択します。
この方法は Plugins\MyPlugin.dll を参照するスクリプトを Unity がコンパイルする際に用いますが、Unity が最終的にプラグインをディレクトリーにコピーする際には Plugins\WSA\MyPlugin.dll が Plugins\MyPlugin.dll の代わりにコピーされます。
Unity はアゼンブリにシリアライズのコードを注入します。つまり、プラグインに MonoBehaviour のクラスがあるときに、Unity がそのパッチを行わないと、ランタイムにシリアライズのエラーが発生する場合があります。
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.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.