using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class test: MonoBehaviour {
[DllImport("__Internal")]
private static extern void test();
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
//开始按钮 创建了一个按钮。
if(GUI.Button(new Rect(0,0,200,50),"点击"))
{
test();
}
}
}
oc:
#if defined (__cplusplus)
extern "C" {
#endif
void test(const char *msg) {
NSLog(@"%s",msg);
}
#if defined (__cplusplus)
}
#endif
//
UnitySendMessage(<#const char *obj#>, <#const char *method#>, <#const char *msg#>)
Unity3D和ios交互
最新推荐文章于 2023-11-02 11:54:04 发布