/// <summary> /// checks to see if the description or component is null and if so adds 1 to their length /// </summary> /// <param name="mod"></param> public static void addIfNull(BMBFmod.mod mod) { try { string temp = mod.components[0].type; } catch (NullReferenceException) { mod.components.Add(new BMBFmod.Component()); } catch (ArgumentOutOfRangeException) { mod.components.Add(new BMBFmod.Component()); } try { string temp = mod.description[0]; } catch (NullReferenceException) { mod.description.Add(""); } catch (ArgumentOutOfRangeException) { mod.description.Add(""); } }
/// <summary> /// Exports mod bmbfmod as path /// </summary> /// <param name="bmbfmod"></param> /// <param name="path"></param> public static void exportBMBFasset(BMBFmod.mod bmbfmod, string path) { TextAsset bmbfjson = new TextAsset(JsonUtility.ToJson(bmbfmod, true)); AssetDatabase.CreateAsset(bmbfjson, path); }