Version: 2022.3
言語: 日本語
Call and implement native UWP plug-ins
Use P/Invoke

Author native UWP plug-ins

To author native Universal Windows Platform (UWP) plug-ins, you need to know how to create native plug-ins for Unity. For more information about native plug-ins and their uses, refer to Native plug-ins.

To author native UWP plug-ins, you can use either a precompiled dynamic-link library (DLL) or the C++ source code.

Precompiled native plug-ins

To P/Invoke into precompiled native plug-ins, you need to:

  1. Load the DLL at runtime.
  2. Find the function entry point.
  3. Call the plug-in.

You need to compile the DLLs against the appropriate Windows SDK for the target CPU architecture. You also need to configure the DLLs in the Plug-in Inspector when you add them to a Unity project.

C++ source code native plug-ins

You can add C++ (.cpp) code files directly into a Unity project, which will act as a plug-in in the Plug-in Inspector. If you configure the plug-ins to be compatible with UWP and the IL2CPP scripting backend, Unity compiles these C++ files together with the C++ code that it generates from managed assemblies.

その他の参考資料

Call and implement native UWP plug-ins
Use P/Invoke
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961