//Returns true if this is the only instance of the missionID in the Table of Contents
        protected bool IsMissionUnique(String id)
        {
            bool isUnique      = true;
            int  instanceCount = 0;

            KMMissionTableOfContents tableOfContents = (KMMissionTableOfContents)serializedTableOfContents.targetObject;

            foreach (var section in tableOfContents.Sections)
            {
                foreach (var missionID in section.MissionIDs)
                {
                    if (missionID.Equals(id))
                    {
                        instanceCount++;

                        if (instanceCount > 1)
                        {
                            isUnique = false;
                            break;
                        }
                    }
                }
            }

            return(isUnique);
        }
    public static void CreateNewTableOfContents()
    {
        if (!AssetDatabase.IsValidFolder("Assets/" + MISSION_FOLDER))
        {
            AssetDatabase.CreateFolder("Assets", MISSION_FOLDER);
        }

        KMMissionTableOfContents tableOfContents = ScriptableObject.CreateInstance <KMMissionTableOfContents>();

        string path = AssetDatabase.GenerateUniqueAssetPath("Assets/" + MISSION_FOLDER + "/TableOfContents.asset");

        AssetDatabase.CreateAsset(tableOfContents, path);
        AssetImporter.GetAtPath(path).assetBundleName = AssetBundler.BUNDLE_FILENAME;

        EditorGUIUtility.PingObject(tableOfContents);
    }
    protected bool IsMissionInTableOfContents(KMMission mission)
    {
        bool isInToC = false;

        KMMissionTableOfContents tableOfContents = (KMMissionTableOfContents)serializedObject.targetObject;

        foreach (var section in tableOfContents.Sections)
        {
            foreach (var missionID in section.MissionIDs)
            {
                if (missionID.Equals(mission.ID))
                {
                    isInToC = true;
                    break;
                }
            }
        }

        return(isInToC);
    }
    public static void CreateNewTableOfContents()
    {
        if (!AssetDatabase.IsValidFolder("Assets/" + MISSION_FOLDER))
        {
            AssetDatabase.CreateFolder("Assets", MISSION_FOLDER);
        }

        KMMissionTableOfContents tableOfContents = ScriptableObject.CreateInstance <KMMissionTableOfContents>();

        string path = AssetDatabase.GenerateUniqueAssetPath("Assets/" + MISSION_FOLDER + "/TableOfContents.asset");

        AssetDatabase.CreateAsset(tableOfContents, path);
        AssetImporter.GetAtPath(path).assetBundleName = ModConfigs.BundleName;

        EditorGUIUtility.PingObject(tableOfContents);

        int numToCs = AssetDatabase.FindAssets("t:KMMissionTableOfContents").Length;

        if (numToCs > 1)
        {
            Debug.LogWarningFormat("Project has {0} KMMissionTableOfContents. Only one table of contents per mod is supported!", numToCs);
        }
    }