unity2019配置xcode

1.main.mm

第19行替换

int main_unity_default(int argc, char* argv[])
{
@autoreleasepool
{
UnityInitTrampoline();
// UnityParseCommandLine(argc, argv); //Unity 5.3+
UnityInitRuntime(argc, argv); //Unity 5.6+,5.4和5.5用哪个我没试过,可以根据报错情况选择。

RegisterMonoModules();
NSLog(@"-> registered mono modules %p\n", &constsection);
RegisterFeatures();

// iOS terminates open sockets when an application enters background mode.
// The next write to any of such socket causes SIGPIPE signal being raised,
// even if the request has been done from scripting side. This disables the
// signal and allows Mono to throw a proper C# exception.
std::signal(SIGPIPE, SIG_IGN);

//UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String:AppControllerClassName]);
// UIApplicationMain(argc, argv, nil, NSStringFromClass([UnitySubAppDelegate class]));
UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String:AppControllerClassName]);
}

return 0;
}

2.UnityAppController.h

第4行插入

#import

第75行替换

NS_INLINE UnityAppController* GetAppController()
{
NSObject* delegate = [UIApplication sharedApplication].delegate;
UnityAppController* currentUnityController = (UnityAppController *)[delegate valueForKey:@"currentUnityController"];
return currentUnityController;
}

3.SplashScreen.mm

第388行替换

void ShowSplashScreen(UIWindow* window)
{
_controller = [[SplashScreenController alloc] init];
[_controller create: window];
}

2019不需要以下

4.DeviceSettings.mm
268

return deviceUnknown;

5.CrashReporter.mm 
81

// InitCrashReporter();

 

2019 .net4.0需修改以下文件

Unity.xcconfig

$(inherited) -DINIT_SCRIPTING_BACKEND=1 -fno-strict-overflow -DNET_4_0 -DRUNTIME_IL2CPP=1 -DIL2CPP_MONO_DEBUGGER=1

 

Build Phases设置

删除DynamicLibEngineAPI.o的引用

你可能感兴趣的:(Unity)