private static void EditXcodeProject(string buildFolder) { PBXProject project = new PBXProject(); string path = Path.Combine(buildFolder, FileUtil.NiceWinPath("Unity-iPhone.xcodeproj/project.pbxproj")); project.ReadFromFile(path); string targetGuid = project.TargetGuidByName(PBXProject.GetUnityTargetName()); if (AdvertisementSettings.enabled && AdvertisementSettings.IsPlatformEnabled(RuntimePlatform.IPhonePlayer)) { string target = Path.Combine(buildFolder, Path.Combine("UnityAds", "UnityAds.framework")); FileUtil.CopyDirectoryRecursive(Path.Combine(extensionPath, FileUtil.NiceWinPath("Editor/Resources/iOS/builds/UnityAds.framework")), target, true); project.AddFileToBuild(targetGuid, project.AddFile(Path.Combine("UnityAds", "UnityAds.framework"), "Frameworks/UnityAds.framework", PBXSourceTree.Source)); project.AddBuildProperty(targetGuid, "FRAMEWORK_SEARCH_PATHS", "$(SRCROOT)/UnityAds"); project.AddFrameworkToProject(targetGuid, "AdSupport.framework", true); project.AddFrameworkToProject(targetGuid, "StoreKit.framework", false); project.AddFrameworkToProject(targetGuid, "CoreTelephony.framework", false); } else { project.RemoveFile(project.FindFileGuidByRealPath(Path.Combine("UnityAds", "UnityAds.framework"))); string[] removeValues = new string[] { "$(SRCROOT)/UnityAds" }; project.UpdateBuildProperty(targetGuid, "FRAMEWORK_SEARCH_PATHS", null, removeValues); string str5 = Path.Combine(buildFolder, "UnityAds"); if (Directory.Exists(str5)) { Directory.Delete(str5, true); } } project.AddFileToBuild(targetGuid, project.AddFile("UnityAdsConfig.h", "Classes/UnityAds/UnityAdsConfig.h")); project.WriteToFile(path); }
private static void CreateUnityAdsConfig(string path) { string[] paths = new string[] { path, FileUtil.NiceWinPath("Classes/UnityAds/UnityAdsConfig.h") }; string str = FileUtil.CombinePaths(paths); string define = "#define USE_UNITYADS"; bool targetValue = AdvertisementSettings.enabled && AdvertisementSettings.IsPlatformEnabled(RuntimePlatform.IPhonePlayer); if (File.Exists(str)) { EditDefineInFile(str, define, targetValue); } else { File.WriteAllText(str, $"// Autogenerated, do not edit #pragma once {define} {!targetValue ? 0 : 1}"); } }
public bool IsIOSEnabled() => AdvertisementSettings.IsPlatformEnabled(RuntimePlatform.IPhonePlayer);
public bool IsAndroidEnabled() => AdvertisementSettings.IsPlatformEnabled(RuntimePlatform.Android);
public bool IsAndroidEnabled() { return(AdvertisementSettings.IsPlatformEnabled(RuntimePlatform.Android)); }
private static IEnumerable <PluginDesc> RegisterPlugins(BuildTarget target) { if (((target == BuildTarget.Android) && AdvertisementSettings.enabled) && AdvertisementSettings.IsPlatformEnabled(RuntimePlatform.Android)) { PluginDesc desc = new PluginDesc { pluginPath = Path.Combine(extensionPath, "Editor/Resources/Android/builds/unity-ads.aar") }; return(new PluginDesc[] { desc }); } return(new PluginDesc[0]); }