【Unity】ネイティブプラグインを作りたい!
上記記事はokuhiiro様の、Android/iOSのプラグイン記事。
まだ作ったことがないので、参考にしたいと思います。
自分が作ったことがあるのは、Windowsのプラグインのみ。
WindowsでWindowsNativePlugin.dllを作成後、Assets\Plugins\x86_64に配置。
public static class NativePlugin
{
public static int GetValue()
{
int ret = getValue();
return ret;
}
#if UNITY_STANDALONE_WIN
[DllImport("WindowsNativePlugin", EntryPoint = "getValue")]
private static extern int getValue();
#elif
[DllImport("__Internal")]
private static extern int getValue();
#...
}
とすれば、プラットフォーム間で、読みわけができます。
(上記コードは動作未検証です、すみません)