Step 1. 从Unity导出Xcode项目.
File->Build Settings->Player Settings

然后右侧Inspector面板,去除Auto Graphics Api选项,只保留一个OpenGLES2
选项. Scripting Backend 选择 IL2CPP
.

Build->导出Xcode工程.(Unity是从Unity导出的项目,UnityToiOS是新建的Xcode项目)

Step 2.开始合并!
- 将
Classes,Libraries,MapFileParser.sh
拖入到项目中,勾选Copy items if needed
,Creat groups
.(文件比较多,耐心等待一小会.)

2.将Data
拖入到项目,勾选Copy items if needed
,勾选Create folder references
.

3.下面是Xcode的一些配置. 删除Main.StoryBoard
,以及Info.plist
的Main storyboard file base name
键值对.

添加Framework
(添加哪些framework,请参照你从Unity导出来的项目,这里我用的是太虚的sdk,所以下面2个.a文件是太虚的,还有上面的opencv2.framework,以自己项目为准!)

5.关闭BitCode

4.Header Search Paths
设置

5.Library Search Paths
设置

6.other C Flags
设置 -DINIT_SCRIPTING_BACKEND=1

7.添加 User-Defined

GCC_THUNB_SUPPORT
-> NO
GCC_USE_INDIRECT_FUNCTION_CALLS
-> NO
UNITY_RUNTIME_VERSION
-> 你导出项目的Unity版本
UNITY_SCRIPTING_BACKEND
- il2cpp

8.新建一个
pch
文件,并设置文件路径
将
Classes
目录下的 Prefix.pch
的内容全部复制到我们自己创建的pch文件.
9.设置 main.m
(Supporting Files->main.m)
将 Classes
目录下的 main.mm
的内容全部复制到Supporting Files下的 main.m
,将后缀改为.mm
.
稍微改动下

注意,从
Build Phases
删除Classes
下的 main.mm
的文件.

10.添加 Run Script


- 修改
AppDelegate.h

修改 AppDelegate.m


12.修改 UnityAppController.h

你可能出现的错误
- Semantic Issue ->
Controller may reach end of non-void function

解决办法: Mismatched Return Type
-> NO

2.duplicate symbol _main in xxxx.

解决办法 :常见错误了. main文件重复. 参照上面 步骤 9
删除一个 main文件
3.Cloud not load NIB in bundle

解决办法: 删除 Launch Screen File
.

END~~~
参考链接:
2.老外录得视频,手把手教学.
网友评论
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
"_glStateCacheTexEnvSrc1", referenced from:
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
"_glStateCacheClientActiveTexture", referenced from:
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
"_glStateCacheDisableDepthTest", referenced from:
_arglDispImage in libHiARWrapper.a(gsub_es.o)
"_glStateCacheTexEnvSrc0", referenced from:
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
"_glStateCacheDisableClientStateNormalArray", referenced from:
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
"_glStateCacheActiveTexture", referenced from:
_arglPixelFormatSet in libHiARWrapper.a(gsub_es.o)
_arglCleanup in libHiARWrapper.a(gsub_es.o)
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
_arglPixelBufferDataUploadBiPlanar in libHiARWrapper.a(gsub_es.o)
"_glStateCacheDisableLighting", referenced from:
_arglDispImage in libHiARWrapper.a(gsub_es.o)
"_glStateCachePixelStoreUnpackAlignment", referenced from:
_arglPixelFormatSet in libHiARWrapper.a(gsub_es.o)
"_glStateCacheBindTexture2D", referenced from:
_arglPixelFormatSet in libHiARWrapper.a(gsub_es.o)
_arglCleanup in libHiARWrapper.a(gsub_es.o)
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
_arglPixelBufferDataUploadBiPlanar in libHiARWrapper.a(gsub_es.o)
"_glStateCacheEnableClientStateTexCoordArray", referenced from:
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
"_glStateCacheTexEnvMode", referenced from:
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
"_glStateCacheDisableTex2D", referenced from:
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
"_glStateCacheEnableTex2D", referenced from:
_arglDispImageStateful in libHiARWrapper.a(gsub_es.o)
这些又遇到过吗
Guideline 3.1.4 - Business - Payments - Content Codes
Your app enables additional features or functionality when used with augmented reality markers. However, those features are not available in the app to users without the necessary markers.
Next Steps
To resolve this issue, please provide a means to access the augmented reality features from within the app, such as through achievements or in-app purchase. If they can be freely obtained, such as through a link to a website, please revise your app to include clear instructions for obtaining the necessary markers.
Please note that apps cannot require users to purchase unrelated products or engage in advertising or marketing activities to unlock app functionality.
这是不是意思就跟您说的那个‘2.识别内容被拒’有关呢
#0 il2cpp::vm::MetadataCache::Initialize()
#1 il2cpp::vm::Runtime::Init(char const*, char const*)
#2 ::InitializeIl2CppFromMain()
#3 ::UnityInitApplicationNoGraphics()
#4 ::-[UnityAppController application:didFinishLaunchingWithOptions:](UIApplication *, NSDictionary *)
#5 ::-[AppDelegate application:didFinishLaunchingWithOptions:](UIApplication *, NSDictionary *)
报:Thread 1:EXC_BAD_ACCESS(code=1,address=0×.......)
万分感谢~~~~
Unity识别界面是个window.