private static void EditorCode(string filePath) { // load UnityAppController.mm UnityEngine.Debug.Log("EditorCode: " + filePath); XClass unityAppController = new XClass(filePath + "/Classes/UnityAppController.mm"); // add codes string codes = "#include \"AllLifecycleRegister.h\"";//add_flag unityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", codes); if (!unityAppController.isExist("continueUserActivity:")) { #if (UNITY_5 || UNITY_5_3_OR_NEWER) unityAppController.WriteBelow("SensorsCleanup();\n}", "- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler\r{\r return YES;\r}"); #else unityAppController.WriteBelow("UnityCleanup();\n}", "- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler\r{\r return YES;\r}"); #endif } }