public static void CreateBuildAsset() { BuildSettingsAsset asset = ScriptableObject.CreateInstance <BuildSettingsAsset>(); asset.targets = new BuildSettingsAsset.Target[1] { new BuildSettingsAsset.Target() }; string path = Application.dataPath + "/TJ/BuildTool"; CreateDirectory(path); if (File.Exists(SettingsPath)) { bool value = EditorUtility.DisplayDialog("Build Warning", "You already have a Build Settings file. Are you sure you want to replave it?", "Yes", "No"); if (!value) { return; } } AssetDatabase.CreateAsset(asset, "Assets/TJ/BuildTool/BuildSettings.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; string[] projectName = Application.dataPath.Split('/'); asset.projectName = projectName[projectName.Length - 2]; }
public static void ChangeProjectSettings(BuildSettingsAsset settings) { PlayerSettings.bundleVersion = settings.major + "." + settings.minor + "." + settings.patch; PlayerSettings.companyName = "Taylor James"; PlayerSettings.productName = settings.projectName; }