Unity3D and iOS original project merger and merger process problems

Due to the needs of the company’s projects, the need to merge the unity3D project with the original project, so we have to contact unity3D, this article is to export the iOS unity3D code transplanted to the Xcode local project, the code:

First of all, in general, the total step is divided into two blocks, first, you need to export Xcode from the unity3D, you need to export the iOS code part of the migration to the local iOS project you want

The first part, unity3D export Xcode project

1 open your unity project, and then click on the top menu bar file build settings

Unity3D and iOS original project merger and merger process problems
1.png

2 will then pop up a box below, click switch platform to select the iOS platform,

Unity3D and iOS original project merger and merger process problems

3 Click player settings… Configuration parameters as shown below

Unity3D and iOS original project merger and merger process problems

4 after the configuration, click build, wait for completion, this process may be a long time point, shaoanwuzao, after the completion of this

Unity3D and iOS original project merger and merger process problems

5 and then open the file iOS folder is so important, we need the core code in this painting line several folders, so we will need to put a few painted red folder copied to we need native iOS project.

Unity3D and iOS original project merger and merger process problems

The first part of the Xcode project has been completed, this part is very simple, and then, we start the second most, it is also prone to error, especially the configuration needs to be noted

The second part, unity3D export Xcode project into the native iOS project

1.Unity export of the bundleId project to be consistent with your local iOS project ID

2 modify bit code for NO

3 remove Main.storyboard, code set controller (easy to switch window)

4 will Classes, Libraries, MapFileParser.sh dragged into the project (select Copy items needed, select Create groups), if

Drag the Data into the project (select Copy items needed, select Create folder references) (if)

Note: the file is not in the same way as the project

Unity3D and iOS original project merger and merger process problems

5 add framework (note Optional’s three)

Unity3D and iOS original project merger and merger process problems
Unity3D and iOS original project merger and merger process problems

6 add Header Search Paths and Library Search Paths

Unity3D and iOS original project merger and merger process problems

7.other C Flags -> -DINIT_SCRIPTING_BACKEND=1

Unity3D and iOS original project merger and merger process problems

8 add User-Defined (UNITY_RUNTIME_VERSION version number and export the Unity version of the project need to be consistent)

Unity3D and iOS original project merger and merger process problems

9 add Run Script

Unity3D and iOS original project merger and merger process problems

10 copy Unity/Classes/Prefix.pch code to the new PCT file and the classes folder under the PCT file to delete, delete and note, here is not completely removed, but removed from the list, select the following steps, that are deleted this meaning, please remember!

Unity3D and iOS original project merger and merger process problems

11 copy the entire content of Classes/main.mm to main.m and change the extension to.Mm

Unity3D and iOS original project merger and merger process problems

12 modify UnityAppController.h

Unity3D and iOS original project merger and merger process problems

13 add the following code in AppDelegate.h.M

Unity3D and iOS original project merger and merger process problems
Unity3D and iOS original project merger and merger process problems

Unity3D and iOS original project merger and merger process problems

Here basically has been completed from the local iOS jump to the Unity project, then, is what I do in the process of the problems encountered

1.Unknown type name’UnityViewControllerBase’

The solution is to change it to UIViewController

2.iOS local application jump unity when a black screen

The reason is that your U3D project integrates the EasyAR plugin, which has a Assets/Plugins/iOS/EasyARAppController.mm,

@interface EasyARAppController: UnityAppController, which is the first controller when the entire app started, and modify their own merger controller on the OK

Or to copy the contents of the EasyARAppController.mm to your custom subclass, and then delete the reference is OK

See Figure

Unity3D and iOS original project merger and merger process problems

Write in this method in UnityAppController.mm

Unity3D and iOS original project merger and merger process problems

And then OK

The above is all Yo, welcome more exchanges!!!

Please indicate the original address / /
!