Unity工程导入iOS之项目配置
1.创建一个新的文件夹用来存放unity文件。将Classes,Libraries,MapFileParser.sh拖到项目中,选中(Copy items if needed和Create groups)。将Data拖到项目中,选中(Copy items if needed和Create folder references)。如图:
2.添加需要的framework:
注意:libiconv.2.dylib 这个的添加方法
Add other 然后全局搜索 command+shift+G 然后输入/usr/lib 查找就可以了
3.添加 Header Search Paths、 Library Search Paths(直接show in finder拖文件进来就行)如图:
4.Other C Fiags,Other C++ Flags设置成-DINIT_SCRIPTING_BACKEND=1 如图:
5.设置User-Defined
设置key值:GCC_THUMB_SUPPORT,设置Value值:NO
设置key值:GCC_USE_INDIRECT_FUNCTION_CALLS,设置Value值:NO
设置key值:UNITY_RUNTIME_VERSION,设置Value值:5.6.5f1 (这里与你的unity项目的版本一致)
设置key值:UNITY_SCRIPTING_BACKEND,设置Value值: il2cpp
6.将Unity/Classes/Prefix.pch 的代码复制到项目里的pch文件
在Project->MyProject->Build Setting 设置Precompile Prefix Header: YES
并在Prefix Header中添加: $(SRCROOT)/Unity/PrefixHeader.pch
7.将Classes/main.mm全部内容复制到main.m 并把扩展名改为.mm, 然后删除Classes/main.mm文件
8.在Build Phases,点+号,添加Run Script
9.Enable Bitcode 设置NO
设置 C Language Dialekt:C99[-std=c99]
设置 C++ Language Dialekt : C++ 11[-std=C++11]
设置 C++ Standard Library : libc++ (LLVM C++ standard Library with C++11 support)
10.在Other Linker Flags添加
-lc++
-weak_framework
CoreMotion
-weak-lSystem
-Wl,-undefined,dynamic_lookup
11.选择Info.plist。添加key值:Unity_LoadingActivityIndicatorStyle,设置Value值:-1。
12 Enable Bitcode 设置成NO
PS:参考大神链接
https://www.jianshu.com/p/487015f3bb13
https://blog.****.net/qq_25519333/article/details/54090907