unity项目整合嵌入iOS主工程
1.嵌入相关配置
1)unity导出的工程与已有工程置于相同根路径下。

2)在已有工程引用三个文件夹,Data 选择Create folder references,Classes和Libraries 选择Create groups。


3)Remove Reference 掉Libraries中libil2cpp group,和Classes—>Native下的所有.h文件。
4)新建PrefixHeader.pch文件。在Classes下Prefix.pch文件代码拷贝至新生成的pct文件。添加 UnityAppController.h 的引用。

5)引用framework(注意Optional的三个)。

6)配置Build Setting。









7)处理iOS已有项目的main.m文件,将.m改为.mm,将Classes下的main.mm内容拷贝至新main文件中,并进行修改。

8)Build Phases中移除Classes下的main.mm文件。
UnityAppController.h

AppDelegate.h

AppDelegate.m

9)其他修改。
2.集成Google cardboard SDK 报错
http://qiita.com/ozawachev/items/ff0728ce4d01ece598ee
1/2
(已解决)
解决方法:增加中间变量

2/2
(待解决)

(已解决)2015.12.06 16:40

3.cardboard SDK 动态改变 AppControllerClassName,导致———— " -[CardboardAppController unityController]: unrecognized selector sent to instance 0x12d591bd0” 错误解决:固定启动appdelegate

4. startSettingsDialog:报错
