public void OnPreprocessBuild(BuildTarget target, string path) #endif { if (AdmixSharedSettings.DebugMode == AppStateMode.ForceSandbox) { EditorUtility.DisplayDialog("Forced Sandbox Build", "Attention! Forced Sandbox mode is in use. Make sure that this build isn't uploaded to the app store, " + "as it won't generate any revenue.", "OK"); } MaterialBuildHelper.TurnOffPlacementsTextures(); if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS && PlayerSettings.stripEngineCode) { if (EditorUtility.DisplayDialog("Admix", "Strip engine code may break Admix web view!\nPlease, use managed stripping only.", "OK")) { PlayerSettings.stripEngineCode = false; } else { Debug.LogError("Admix: Strip engine code enabled."); } } }
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) { MaterialBuildHelper.TurnOnPlacementsTextures(); #if UNITY_IOS if (target != BuildTarget.iOS) { return; } string projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj"; var proj = new PBXProject(); proj.ReadFromString(File.ReadAllText(projPath)); #if UNITY_2019_3_OR_NEWER string targetGuid = proj.GetUnityMainTargetGuid(); proj.AddBuildProperty(targetGuid, "OTHER_LDFLAGS", "-ObjC"); proj.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO"); targetGuid = proj.GetUnityFrameworkTargetGuid(); proj.AddBuildProperty(targetGuid, "OTHER_LDFLAGS", "-ObjC"); proj.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO"); #else string targetGuid = proj.ProjectGuid(); proj.AddBuildProperty(targetGuid, "OTHER_LDFLAGS", "-ObjC"); proj.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO"); targetGuid = proj.TargetGuidByName("Unity-iPhone"); proj.AddBuildProperty(targetGuid, "OTHER_LDFLAGS", "-ObjC"); proj.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO"); #endif File.WriteAllText(projPath, proj.WriteToString()); #endif }
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) { MaterialBuildHelper.TurnOnPlacementsTextures(); #if UNITY_IOS if (target != BuildTarget.iOS) { return; } string projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj"; var proj = new PBXProject(); proj.ReadFromString(File.ReadAllText(projPath)); string targetGuid = proj.TargetGuidByName("Unity-iPhone"); proj.AddBuildProperty(targetGuid, "OTHER_LDFLAGS", "-ObjC"); File.WriteAllText(projPath, proj.WriteToString()); #endif }
public void OnPreprocessBuild(BuildTarget target, string path) #endif { MaterialBuildHelper.TurnOffPlacementsTextures(); bool appTokenIsEmpty = AdmixPreferences.Instance != null && AdmixPreferences.Instance.ApplicationTokenPresent; bool applicationIdentifierIsEmpty = AdmixPreferences.Instance != null && string.IsNullOrEmpty(AdmixPreferences.Instance.ApplicationIdentifier); bool applicationNameIsEmpty = AdmixPreferences.Instance != null && string.IsNullOrEmpty(AdmixPreferences.Instance.ApplicationName); bool forceSandboxModeEnabled = AdmixPreferences.Instance != null && AdmixPreferences.Instance.AppStateMode == AppStateMode.ForceSandbox; if (appTokenIsEmpty) { if (EditorUtility.DisplayDialog("Admix", "Your application token is empty!\nPlease, save placements before the build.", "OK")) { Selection.objects = new UnityEngine.Object[] { AdmixPreferences.Instance } } ; } else if (applicationIdentifierIsEmpty || applicationNameIsEmpty) { if (EditorUtility.DisplayDialog("Admix", "Your application identifier or application name is empty!\nPlease click \"Save Placements\" button before the build.", "OK")) { try { EditorWindow.GetWindow <global::Admix.AdmixCore.Editor.AdmixEditor>(); } catch (System.Exception) { AdmixDebug.LogWarning("Failed GetWindow()"); } Selection.objects = new UnityEngine.Object[] { AdmixPreferences.Instance }; } } else if (forceSandboxModeEnabled) { if (EditorUtility.DisplayDialog("Admix", "You are in Sandbox mode.", "Switch to Default", "Continue with Sandbox")) { AdmixPreferences.Instance.AppStateMode = AppStateMode.Default; } } if ((EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android || EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS) && PlayerSettings.stripEngineCode) { if (EditorUtility.DisplayDialog("Admix", "Strip engine code may break Admix web view!\nPlease, use managed stripping only.", "OK")) { PlayerSettings.stripEngineCode = false; } } } }