public static void OnPostProcessBuild(BuildTarget build, string path) { //Make sure this build is for iOS. //Unity 4 uses 'iPhone' for the enum value; Unity 5 changes it to 'iOS'. if (build.ToString() != "iPhone" && build.ToString() != "iOS") { UnityEngine.Debug.LogWarning("Skillz cannot be set up for a platform other than iOS."); return; } if (Application.platform != RuntimePlatform.OSXEditor) { UnityEngine.Debug.LogError("Skillz cannot be set up for XCode automatically on a platform other than OSX."); return; } //Get whether this is an append build by checking whether a custom file has already been created. //If it is, then nothing needs to be modified. string checkAppendFilePath = Path.Combine(path, checkAppendFileName); FileInfo checkAppend = new FileInfo(checkAppendFilePath); if (checkAppend.Exists) { return; } checkAppend.Create().Close(); bool trySetUp = SetUpOrientation(path) && SetUpSDKFiles(path); if (!trySetUp) { //These failures aren't fatal; the developer can do them manually. UnityEngine.Debug.LogWarning("Skillz automated steps failed!"); } //Set up XCode project settings. SkillzXCProjEdit editProj = SkillzXCProjEdit.LoadXCProj(path); if (editProj == null || !editProj.AddLinkerFlags() || !editProj.AddSkillzFiles() || !editProj.AddRunScript() || !editProj.SaveChanges()) { UnityEngine.Debug.LogError("Skillz automated XCode editing failed!"); return; } }
public static void OnPostProcessBuild(BuildTarget build, string path) { //Make sure this build is for iOS. //Unity 4 uses 'iPhone' for the enum value; Unity 5 changes it to 'iOS'. if (build.ToString() != "iPhone" && build.ToString() != "iOS") { UnityEngine.Debug.LogWarning("Skillz cannot be set up for a platform other than iOS."); return; } if (Application.platform != RuntimePlatform.OSXEditor) { UnityEngine.Debug.LogError("Skillz cannot be set up for XCode automatically on a platform other than OSX."); return; } //Get whether this is an append build by checking whether a custom file has already been created. //If it is, then nothing needs to be modified. string checkAppendFilePath = Path.Combine(path, checkAppendFileName); FileInfo checkAppend = new FileInfo(checkAppendFilePath); if (checkAppend.Exists) { return; } checkAppend.Create().Close(); bool trySetUp = SetUpSDKFiles(path); if (!trySetUp) { //These failures aren't fatal; the developer can do them manually. UnityEngine.Debug.LogWarning("Skillz XCode export is missing Skillz Framework."); } //Set up XCode project settings. SkillzXCProjEdit editProj = SkillzXCProjEdit.LoadXCProj(path); if (editProj == null || !editProj.AddRunScript() || !editProj.SaveChanges()) { UnityEngine.Debug.LogError("Skillz automated XCode editing failed!"); return; } XCProject project = new XCProject(path); if (project != null) { project.AddFile(path + "/Skillz.framework", project.GetGroup("Embed Frameworks"), "SOURCE_ROOT", true, false, true); //AddFile should also add FrameworkSearchPaths if required but doesn't project.AddFrameworkSearchPaths("$(PROJECT_DIR)"); project.AddOtherLDFlags("-ObjC -lc++ -lz -lsqlite3 -lxml2 -weak_framework PassKit -framework Skillz"); //Unity_4 doesn't exist so we check for Unity 5 defines. Unity 6 is used for futureproofing. #if !UNITY_5 && !UNITY_6 project.AddFile(Application.dataPath + "/Skillz/Build/IncludeInXcode/Skillz+Unity.mm"); #endif project.Save(); } else { UnityEngine.Debug.LogError("Skillz automated XCode export failed!"); return; } }