Unity iOS 互相调用
2016-04-16 22:01
483 查看
1、Unity调用iOS:
1.1、在Unity C#中:
1.2、在Xcode Objective-C中:
2、在iOS中调用Unity:
2.1、在Xcode Objective-C中:
2.2、在Unity C#中:
1.1、在Unity C#中:
[ DllImport( "__Internal" )] private static extern int _showSelectTitleDialog ( string title, string msg);
1.2、在Xcode Objective-C中:
extern "C" { int _showSelectTitleDialog(const char *title, const char *msg) { return [[UNDialogManager sharedManager] showSelectDialog:[NSString stringWithUTF8String:title] message:[NSString stringWithUTF8String:msg]]; } }
2、在iOS中调用Unity:
2.1、在Xcode Objective-C中:
UnitySendMessage("DialogManager", "OnCancel", tag.UTF8String);
2.2、在Unity C#中:
public void OnCancel ( string idStr) { int id = int.Parse (idStr); if (_delegates.ContainsKey (id)) { _delegates [id] (-1); _delegates.Remove (id); Debug.LogWarning ( "===OnCancel idStr1:" + idStr); } else { Debug.LogWarning ( "===OnCancel idStr2:" + idStr); } }
参考
相关文章推荐
- Unity3D开发者快速上手Unreal Engine 4指南
- 万能游戏框架
- Unity API - C
- Unity API - B
- Unity3D学习日记(一)使用UGUI制作虚拟摇杆
- 【Unity闲谈】关于制作 Voxel(体素,3D像素)模型并导入Unity
- Unity3D学习步骤
- Unity3d的Mono编辑不了的问题
- [Unity热更新]tolua# & LuaFramework(八):更新下载(上)
- Unity Shaders and Effects Cookbook (3-6) 创建各向异性高光类型(Anisotropic) 模拟金属拉丝效果
- MySQL Community Server 5.7.12配置
- Unity3D性能优化:DrawCall优化
- [Unity优化] Unity CPU性能优化
- 【Unity】6.3 通过 C# 脚本创建和访问游戏对象
- 【Unity】6.2 在VS2015中调试 C# 脚本
- Unity3d 模拟视锥的实现
- Unity3d 模拟视锥的实现
- 【Unity】6.1 Unity中的C#脚本基础知识
- 【Unity】第6章 Unity脚本开发基础
- Unity3D教程宝典之 AnimationCurve