Skip to content

Instantly share code, notes, and snippets.

@baobao
Last active February 14, 2025 12:18
Show Gist options
  • Save baobao/b7f8fe7e328f9fc5c64196dd949f0f14 to your computer and use it in GitHub Desktop.
Save baobao/b7f8fe7e328f9fc5c64196dd949f0f14 to your computer and use it in GitHub Desktop.
extern "C"
{
float _fooPluginFunction ()
{
return 42.8F;
}
}
using System.Runtime.InteropServices;
using UnityEngine;
public class UsePlugin : MonoBehaviour
{
// 戻り値の型をあわせる必要あり
[DllImport("__Internal")]
static extern float _fooPluginFunction();
void Awake ()
{
var value = _fooPluginFunction();
// ネイティブプラグインから値を取得してログ出力
Debug.Log(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment