private static bool UpdateUpdaterAsset(string setupName, string branch) { UpdaterSettings updaterSettings; bool foundExistingAsset = AssetDatabaseUtil.LoadAsset <UpdaterSettings>(out updaterSettings); if (!foundExistingAsset) { Debug.LogWarning("NO UPDATER SETTINGS ASSET FOUND"); return(false); } if (!string.IsNullOrEmpty(setupName)) { updaterSettings.SetupName = setupName; } if (!string.IsNullOrEmpty(branch)) { updaterSettings.ProjectName = branch; } EditorUtility.SetDirty(updaterSettings); AssetDatabase.SaveAssets(); return(true); }
private static Version UpdateVersionAsset(int buildNumber, string version, string branch) { Version versionInfo; bool foundExistingAsset = AssetDatabaseUtil.LoadAsset <Version>(out versionInfo); if (!foundExistingAsset) { Debug.LogWarning("NO VERSION ASSET FOUND"); versionInfo = ScriptableObject.CreateInstance <Version>(); } versionInfo.buildNumber = buildNumber; if (!string.IsNullOrEmpty(version)) // only override existing value when passed { versionInfo.versionString = version; } if (!string.IsNullOrEmpty(branch)) { versionInfo.branchName = branch; } EditorUtility.SetDirty(versionInfo); AssetDatabase.SaveAssets(); return(versionInfo); }