private static void CreatePackageExportData() { PackageExportData asset = ScriptableObject.CreateInstance <PackageExportData>(); AssetDatabase.CreateAsset(asset, "Assets/PackageExport.asset"); AssetDatabase.SaveAssets(); }
private static void CreatePackageExportData() { PackageExportData asset = ScriptableObject.CreateInstance <PackageExportData>(); AssetDatabase.CreateAsset(asset, "Assets/PackageExport.asset"); AssetDatabase.SaveAssets(); //Show Asset in Inspector Selection.activeObject = AssetDatabase.LoadMainAssetAtPath("Assets/PackageExport.asset"); }
public void OnGUI() { #if UNITY_5_1_OR_NEWER titleContent.text = "Export Utility"; #endif for (int i = 0; i < potentialPackages.Length; i++) { #if !UNITY_5_5_OR_NEWER expanded[i] = EditorGUILayout.Foldout(expanded[i], potentialPackages[i].exportSpec.pathsToExport[0]); #else expanded[i] = EditorGUILayout.Foldout(expanded[i], potentialPackages[i].exportSpec.pathsToExport[0], true); #endif if (expanded[i]) { PackageExportData ed = potentialPackages[i].exportSpec; potentialPackages[i].selected = EditorGUILayout.Toggle("Export?", potentialPackages[i].selected); GUI.enabled = potentialPackages[i].selected; ed.packageName = EditorGUILayout.TextField("Package Name", ed.packageName); ed.packageVersion = EditorGUILayout.TextField("Package Version", ed.packageVersion); ed.license = EditorGUILayout.TextField("Package License", ed.license); GUI.enabled = true; } EditorGUILayout.Space(); } if (GUILayout.Button("Export selected packages")) { foreach (PackageInfoHelper pInfoHelper in potentialPackages) { if (!pInfoHelper.selected) { continue; } Exporter exporter = new Exporter(); exporter.SetExportSpec(pInfoHelper.exportSpec); exporter.Export(); } } }