你不需要源文件,即使頭文件不需要,只要你知道函數的聲明。
如Building Plugins for iOS描述:
1)把你的某文件中的資產/插件/ iOS的
2)看看頭文件來得到你所需要的如函數簽名
public class IPodHandler {
[DllImport("__Internal")]
private static extern void RegisterUnityIPodCallbackListener (string gameObject, string method);
public static void MyRegisterUnityIPodCallbackListener() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
RegisterUnityIPodCallbackListener (GAME_OBJECT, METHOD);
}
}
}
4.)調用在適當的位置:
IPodHandler.MyRegisterUnityIPodCallbackListener ("MyCallbackGameObject", "MyCallbackMethod");
常見的問題:
void RegisterUnityIPodCallbackListener (const char* gameObject, const char* method);
3)通過C#類內聲明RegisterUnityIPodCallbackListener
你不應該建立資產/插件中的目錄結構/ iOS版,否則文件不會在編輯器中播放
來源
2013-10-31 19:57:27
Kay
是否真的需要2號?我想構建一個使用各種C++ 11功能的靜態庫,所以我一直在使用libC++(支持C++ 11的LLVM C++標準庫)。 雖然我無法獲得最終的Unity XCode項目鏈接,但如果#2屬實,我看不到解決方案。 – dimitrios