これらの設定を見るには Unity エディターの Project ウィンドウに移動し、 プラグインのファイルを選び、Inspector ウィンドウで Platform settings > Universal Windows Platform (Windows アイコン) の順に選択します。
プロパティー | 機能 |
---|---|
SDK | ドロップダウンで Any SDK 、または特定の SDK を選び、プラグインが互換性を持つ SDK を設定します。 |
CPU | ドロップダウンでプラグインを Any CPU (すべての APU に互換)、または、 32-bit、64-bit、ARM (いずれかのプレイヤーに制限) を選択します。 |
Don’t process (マネージアセンブリのみに適用) |
このボックスにチェックを入れると、このアセンブリのパッチを無効にします。アセンブリに Unity によるシリアライズが可能なクラスが含まれる場合、パッチが必要です。このような場合、Unity はアセンブリに IL コードを追加します。アセンブリにこのようなクラスが含まれていないと分かっている場合、パッチを無効にして問題ありません。 注意 Unity はアセンブリにシリアライズのコードを加えます。そのため、プラグインに MonoBehaviour のクラスがあるときに Unity がそのパッチを行わないと、ランタイムにシリアライズのエラーが発生する場合があります。 |
Placeholder (マネージアセンブリのみに適用) |
ユニバーサル Windows プラットフォームでは、.NET Core に対してプラグインをコンパイルできますが、Unity エディターは Mono 上で実行するため、このようなアセンブリを認識できません。その結果、C# ファイルはそれらを参照できなくなります。これを解決するには、同じ API をもつ .NET 4.x 用にコンパイルしたアセンブリが必要です。これは、実際のプラグインのプレースホルダーのように動作します (次のセクション参照)。 |
詳細は、プラグインインスペクター を参照してください。
Windows ランタイム APIs を使用する場合、Unity エディターでユニバーサル Windows プラットフォーム専用のプラグインを使用することはできません。ここでは、Unity エディターでこれをどのように処理するかを説明します。
ユニバーサル Windows プラットフォームだけのためにプラグインを使用し、Unity エディターでは使用しない場合は、プレースホルダーを作成する必要はありません。その場合は、プラグイン API を使用するコードを以下のようにラップします。
# if !UNITY_EDITOR
// プラグインコード
# endif
ユニバーサル Windows プラットフォームと Unity エディター両方のためにプラグインを使用したい場合は、プレースホルダーが必要です。以下の 2 つのプラグインを作ります。
両プラグインとも同じ名とアセンブリバージョンを共有する必要があります。Unity エディターのプレースホルダープラグインは UnityEditor.dll を参照できません。それを行うと、エラーが発生します。
エディター内でプラットフォームをそれぞれに割り当てる方法は以下の手順の通りです。
Unity エディターの Project ウィンドウで、エディターと互換性のあるプレースホルダープラグインを選択します。Inspector ウィンドウで、 Select platforms for plugin に移動し、ただ 1 つの互換性のあるプラットフォームとして Editor を選択します。
Unity エディターの Project ウィンドウで、ユニバーサル Windows プラットフォームと互換性のあるプレースホルダープラグインを選択します。Inspector ウィンドウで、 Select platforms for plugin に移動し、ただ 1 つの互換性のあるプラットフォームとして Universal Windows Platform を選択します。
ユニバーサル Windows プラットフォームと互換性のあるプラグインの Inspector ウィンドウで、Placeholder フィールドをエディターと互換性のあるプレースホルダープラグインに設定します。
つまり、ユニバーサル Windows プラットフォーム用にビルドする場合は、 Unity では、スクリプトをコンパイルするときにエディターと互換性のあるプレースホルダープラグインを使用します。ただし、ユニバーサル Windows プラットフォームと互換性のあるプラグインを最終的なフォルダーにコピーします。これにより、Unity エディターは正常にスクリプトをコンパイルし、しかも、ビルドされたゲームは、ユニバーサル Windows プラットフォーム専用プラグインの API を使用できます。
•2018–08–03 限られた 編集レビュー で修正されたページ
.NET 3.5 スクリプティングランタイムは 2018.3 で非推奨
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.