Managed plug-ins

Plugin インスペクター

Use the Plugin Inspector to specify the conditions under which Unity loads and references a plugin file. You can also specify various other platform-specific settings for a plugin.

Select a plugin file in the Project window to view the Plugin Inspector:

Plugin Inspector for MyPlugin.dll
Plugin Inspector for “MyPlugin.dll”


The Auto Reference setting controls how a plugin file is referenced by other assemblies and assembly definitions in the project.

If Auto Reference is checked, which is the default, then all predefined assemblies and assembly definitions automatically reference the plugin file. Uncheck Auto Reference if you want to explicitly declare references to the plugin instead.

You can declare references to a plugin file for an assembly definition using the Assembly Definition Inspector window. See Script Compilation and Assembly Definition Files for more information.

Important: when you uncheck Auto Reference you cannot reference a plugin from the predefined assemblies created for your project by Unity. These predefined assemblies contain all the scripts in your project that you have not assigned to another assembly using an assembly definition file. Only code included in an assembly created with an assembly definition file can reference classes, functions, or other resources in a plugin that has the Auto Reference property unchecked..

Set Auto Reference to false in order to limit the scope in which a plugin can be referenced by explicitly declare all references to that plugin. For example, if only one set of scripts in your project use a plugin, you could create an assembly definition file for those scripts and create an explicit reference to the plugin. Because the plugin is no longer automatically referenced throughout your project, other scripts in your project cannot mistakenly use the plugin. (More than one assembly can use the plugin, but all assemblies must explicitly declare the dependency.) Also, if you change the plugin, only the dependent assemblies must be recompiled, not your entire project.

You can also use explicit references to plugins to prevent plugins used in an Asset package from conflicting with other code in a project into which the package is imported.

Select platforms for plugin

Use the Select platforms for plugin setting to define the platforms with which a plugin file is compatible and should be used on. The list of platforms includes the Editor itself (for Play mode and for any scripts that run at edit time), Standalone, and platforms for which you have installed Unity build support, such as Android, iOS, and WebGL.

You can check Any Platform and, optionally, exclude individual platforms. Or you can uncheck Any Platform and, optionally, include individual platforms.

Platform settings

Once you have selected the platforms, you can specify additional options such as CPU type and specific OS from the separate Platform settings section below. This area of the Inspector window contains a tab for each selected platform. Some platforms have no settings, or just a few (such as CPU and OS selection).

When possible, the Inspector only shows settings that apply to the plugin type on a specific platform. For example, for a native plugin file with a .dll extension, the Inspector only shows the options that apply to Windows since such a plugin can only be used on Windows.

Note: Native plugins cannot be unloaded. If a plugin has already been loaded by the Editor, it remains loaded even after you change the settings for that plugin in the same Editor session. To unload the plugin, you must restart Unity.


Use the Editor platform settings to specify the CPU architectures and operating systems with which the plugin is compatible.


Most managed plugins are compatible with any CPU and OS, but native plugins are typically only compatible with a single OS and, depending on how they were compiled, might be compatible with only a single CPU architecture.

For instance, if you select CPU X86, Unity loads the plugin when you run an older, 32-bit version of the Editor, but not when you run a 64-bit version.

Similarly, if you select OS Windows, Unity loads the plugin when running the Editor on Windows systems, but not on OS X or Linux systems.


For the Standalone platforms, Windows, OS X, Linux, you can choose the CPU architectures with which a library is compatible. Managed libraries are typically compatible with any OS and architecture unless they access specific system APIs. Native libraries are only compatible with a single OS, but can be compatible with the 32-bit, the 64-bit, or both CPU architectures.

See also: Player settings for Standalone platforms.

ユニバーサル Windows プラットフォーム

Universal Windows Platform plugin settings are covered in their own section. For more information, see Universal Windows Platform: Plugins on IL2CPP Scripting Backend.


For plugin files that are potentially compatible with Android, you can choose the CPU architecture. The chosen architecture must match the architecture for which the library was compiled. Unity does not validate whether you choose the correct setting.

iOS and tvOS

The iOS and tvOS settings allow you to specify which iOS frameworks a plugin depends upon, if any.

フレームワークの依存関係を表示する iOS プラグイン設定
フレームワークの依存関係を表示する iOS プラグイン設定

For dynamically loaded libraries, as well as for bundles and frameworks containing dynamically loaded libraries or any assets and resources that need to be loaded at run time, check the Add to Embedded Binaries option. When you check this option, Unity sets the Xcode project options to copy the plugin file into the final application package.

For plugin source code files, which must be compiled as part of the build, you can specify any flags needed when compiling in the Compile Flags field.

## Define Constraints

Use the Define Constraints setting to specify symbols that must be defined (or undefined) in order for the plugin file to be used.

Unity only loads and references a plugin if all the Define Constraints are satisfied. Constraints work like the #if preprocessor directive in C#, but on the assembly level instead of the script level. All the symbols in the Define Constraints setting must be defined for the constraints to be satisfied. You can also specify that a symbol must be undefined by prefixing it with a negating ! (bang) symbol. For example, if you specify the following symbols as your Define Constraints:

Define Constraints
Define Constraints

the constraints are satisfied when the symbol ENABLE_IL2CPP is NOT defined and the symbol UNITY_2018_3_OR_NEWER IS defined. Or to put it differently, this assembly is only loaded and referenced on non-IL2CPP scripting runtimes for Unity 2018.3 or newer.

You can use any of Unity’s built-in define symbols or any symbols defined in the project’s Scripting Define Symbols Player setting. See Platform dependent compilation for more information, including a list of the built-in symbols. Note that the Scripting Define Symbols settings are platform-specific. Make sure that you define the necessary symbols on all the relevant platforms.

Plugin detection

Unity detects whether a file in your Assets folder is a plugin by its file extension. It treats files with the following extensions as plugins:

  • .dll
  • .winmd
  • .so
  • .jar
  • .aar
  • .xex
  • .def
  • .suprx
  • .prx
  • .sprx
  • .rpl
  • .cpp
  • .cc
  • .c
  • .h
  • .jslib
  • .jspre
  • .bc
  • .a
  • .m
  • .mm
  • .swift
  • .xib

Unity also treats certain folders as bundle plugins. Unity does not look for additional plugin files within such folders, so everything within the folder is considered a single plugin. Unity detects whether a folder is a bundle plugin when it has one of the following extensions:

  • .framework
  • .bundle
  • .plugin

Finally, Unity treats folders found with a parent path matching exactly Assets/Plugins/Android/ as an Android Library plugin folder. Unity handles such folders in the same way as folders with the special extensions: .plugin, .bundle and .framework.


Unity sets defaults for the import settings of a plugin file according to the folder where the plugin is located:

フォルダー デフォルト設定
Assets/../Editor プラグインはエディターでのみ互換性があると判断され、プラットフォームへとビルドした際には使用されません。
Assets/\../Editor/(x86x86_64 または x64) プラグインはエディターでのみ互換性があると判断され、CPU に応じて使用するプラグインを割り当てます。
Assets/\../Plugins/(x86_64 または x64) 64ビットのスタンドアロンのプラグインとして判断されます。
Assets/../Plugins/x86 32ビットのスタンドアロンのプラグインとして判断されます。
Assets/Plugins/Android/(x86armeabi または armeabi-v7a) プラグインは Android でのみ互換性があると判断され、CPU ごとに分かれたフォルダーが存在する場合は、CPU に応じて使用するプラグインを割り当てます。
Assets/Plugins/iOS プラグインは iOS でのみ互換性があると判断されます。
Assets/Plugins/WSA/(x86 または ARM) プラグインはユニバーサル Windows プラットフォームのみと互換性を持つように設定されます。サブフォルダーに CPU がある場合は、CPU の値も同様に設定されます。WSA の代わりに Metro が使用されます。
Assets/Plugins/WSA/(SDK80SDK81 または PhoneSDK81) 上記と同じで SDK に応じて使用するプラグインを割り当てることができます。また CPU のサブフォルダーを追加することも可能です。互換性を持たせるために、SDK81 は Win81 と同じで、PhoneSDK81 は WindowsPhone81 と同じ意味になります。
Assets/Plugins/Tizen プラグインは Tizen でのみ互換性があると判断されます。
Assets/Plugins/PS4 プラグインは Playstation 4 でのみ互換性があると判断されます。

  • 2018–11–26

  • Samsung TV サポートを削除

  • Added Auto Reference and Define Constraints for plugins in 2018.3 NewIn20183

Managed plug-ins