- Home /
AppendProject error
using System; using System.IO; using System.Reflection; using System.Collections; using System.Collections.Generic;
using UnityEngine; using UnityEditor; using UnityEditor.Callbacks; using UnityEditor.XCodeEditorChartboost;
namespace ChartboostSDK { public class ChartboostPostProcess : MonoBehaviour {
[PostProcessBuild(-10)]
public static void OnPostProcessBuildCleanup(BuildTarget target, string path)
{
CBCleanup.Clean();
}
[PostProcessBuild(5000)]
public static void OnPostProcessBuild(BuildTarget target, string path)
{
if(target == BuildTarget.iOS && !EditorUserBuildSettings.appendProject) {
PostProcessBuild_iOS(path);
}
else if(target == BuildTarget.Android) {
PostProcessBuild_Android(path);
}
}
private static void PostProcessBuild_iOS(string path)
{
ProcessXCodeProject(path);
}
private static void PostProcessBuild_Android(string path)
{
// Check for manifest issues
if (!CBManifest.CheckAndFixManifest())
{
// If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build.
CBManifest.GenerateManifest();
}
}
private static void ProcessXCodeProject(string path)
{
UnityEditor.XCodeEditorChartboost.XCProject project = new UnityEditor.XCodeEditorChartboost.XCProject(path);
// Find and run through all projmods files to patch the project
string projModPath = System.IO.Path.Combine(Application.dataPath, "Chartboost/Editor");
var files = System.IO.Directory.GetFiles(projModPath, "*.projmods", System.IO.SearchOption.AllDirectories);
foreach (var file in files)
{
project.ApplyMod(file);
}
project.Save();
}
}
}
////////////////////////////////////// ///How do i fix this error about -
if(target == BuildTarget.iOS && !EditorUserBuildSettings.appendProject) /// ///Error on appendProject /// ///This won't work in unity 5.0.1 /////////////////////////////////////
Answer by ExNinja · Jul 17, 2017 at 10:01 PM
Thanks, @zaid87 for the great answer. It looks like this has now broken again with Unity 2017, but the following code will make it work:
#if UNITY_5 || UNITY_5_3_OR_NEWER
if(target == BuildTarget.iOS) {
PostProcessBuild_iOS(path);
}
#else
// UNITY_4_0 to UNITY_4_6
if(target == BuildTarget.iPhone && !EditorUserBuildSettings.appendProject) {
PostProcessBuild_iOS(path);
}
#endif
Answer by zaid87 · Jul 03, 2015 at 08:45 AM
Although this is an old question, I just placed an answer in the case someone else have the same problem (I did at least, and saw this question).
It seems like Chartboost themselves already fixed this issue in their newer SDK version for Unity. Here's some of the code that handles this issue (they checked for Unity version):
#if UNITY_5
if(target == BuildTarget.iOS) {
PostProcessBuild_iOS(path);
}
#else
// UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6
if(target == BuildTarget.iPhone && !EditorUserBuildSettings.appendProject) {
PostProcessBuild_iOS(path);
}
#endif
Hope this helps someone that run into the same issue as we did.
Your answer
Follow this Question
Related Questions
Exp / Inp Fbx Animated character problems 0 Answers
Unexpected token: targetPos 1 Answer
How to make muzzle flashes for an automatic rifle 1 Answer
Asset store 1 Answer