diff --git a/AssetStoreTools.sln b/AssetStoreTools.sln index 858ed86..ce618ca 100644 --- a/AssetStoreTools.sln +++ b/AssetStoreTools.sln @@ -1,12 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetStoreTools", "AssetStoreTools\AssetStoreTools.csproj", "{2D609DFC-C51E-4172-AF19-2F9022F1C691}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetStoreToolsExtra", "AssetStoreToolsExtra\AssetStoreToolsExtra.csproj", "{C0188F1E-2DF8-4205-8AE9-11A934EDAB6F}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -17,10 +15,6 @@ Global {2D609DFC-C51E-4172-AF19-2F9022F1C691}.Debug|Any CPU.Build.0 = Debug|Any CPU {2D609DFC-C51E-4172-AF19-2F9022F1C691}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D609DFC-C51E-4172-AF19-2F9022F1C691}.Release|Any CPU.Build.0 = Release|Any CPU - {C0188F1E-2DF8-4205-8AE9-11A934EDAB6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C0188F1E-2DF8-4205-8AE9-11A934EDAB6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C0188F1E-2DF8-4205-8AE9-11A934EDAB6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C0188F1E-2DF8-4205-8AE9-11A934EDAB6F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/AssetStoreTools/AssetBundler3.cs b/AssetStoreTools/AssetBundler3.cs index 8071e35..32d37f6 100644 --- a/AssetStoreTools/AssetBundler3.cs +++ b/AssetStoreTools/AssetBundler3.cs @@ -11,13 +11,17 @@ public bool CanPreview() public bool CanGenerateBundles() { - return PlayerSettings.advancedLicense; + return false; // old code: PlayerSettings.advancedLicense; } public bool CreateBundle(UnityEngine.Object asset, string targetPath) - { - return BuildPipeline.BuildAssetBundle(asset, null, targetPath, (BuildAssetBundleOptions)1048576); - } + { + // BuildPipeline.BuildAssetBundle is obsolete and this AssetBundler is just a fallback. + // So we can just say "no". + return false; + + // return BuildPipeline.BuildAssetBundle(asset, null, targetPath, (BuildAssetBundleOptions)1048576); + } public void Preview(string assetpath) { diff --git a/AssetStoreToolsExtra/AssetBundler4.cs b/AssetStoreTools/AssetBundler4.cs similarity index 100% rename from AssetStoreToolsExtra/AssetBundler4.cs rename to AssetStoreTools/AssetBundler4.cs diff --git a/AssetStoreTools/AssetBundlerFactory.cs b/AssetStoreTools/AssetBundlerFactory.cs index f715905..66fc164 100644 --- a/AssetStoreTools/AssetBundlerFactory.cs +++ b/AssetStoreTools/AssetBundlerFactory.cs @@ -11,31 +11,8 @@ public static IAssetBundler GetBundler() Type type = assembly.GetType("UnityEditorInternal.AssetStoreToolUtils"); if (type != null && type.GetMethod("BuildAssetStoreAssetBundle") != null) { - DebugUtils.Log("AssentBundler runatime Detection"); - IAssetBundler assetBundler = null; - try - { - Assembly assembly2 = Assembly.LoadFrom("Assets\\AssetStoreTools\\Editor\\AssetStoreToolsExtra.dll"); - Type[] types = assembly2.GetTypes(); - Type[] array = types; - for (int i = 0; i < array.Length; i++) - { - Type type2 = array[i]; - DebugUtils.Log(type2.ToString()); - } - Type type3 = assembly2.GetType("AssetBundler4"); - object obj = Activator.CreateInstance(type3); - assetBundler = (IAssetBundler)obj; - } - catch (Exception ex) - { - DebugUtils.LogError("Error Loading Assembly:" + ex.Message); - } - if (assetBundler == null) - { - DebugUtils.LogError("Error Instantiating bundler"); - assetBundler = new AssetBundler3(); - } + DebugUtils.Log("AssetBundler runtime Detection"); + IAssetBundler assetBundler = new AssetBundler4(); return assetBundler; } } diff --git a/AssetStoreTools/AssetStoreTools.csproj b/AssetStoreTools/AssetStoreTools.csproj index 6a18963..329f410 100644 --- a/AssetStoreTools/AssetStoreTools.csproj +++ b/AssetStoreTools/AssetStoreTools.csproj @@ -25,6 +25,9 @@ pdbonly true + + 4 + @@ -37,6 +40,7 @@ + diff --git a/AssetStoreTools/FileSelector.cs b/AssetStoreTools/FileSelector.cs index dfd3638..b880afc 100644 --- a/AssetStoreTools/FileSelector.cs +++ b/AssetStoreTools/FileSelector.cs @@ -172,7 +172,7 @@ public void RenderIconText() { GUILayout.Height(21f) }); - GUILayout.FlexibleSpace(); + //GUILayout.FlexibleSpace(); } } @@ -279,16 +279,37 @@ public void Accept() return linkedList; } - void SelectNode(FileNode fileNode) + void SelectNode(FileNode fileNode, bool select = true) { - if (!fileNode.isDirectory) + if (!fileNode.isDirectory && fileNode.Selected != select) { - this.m_SelectedFiles.AddLast(fileNode); - fileNode.Selected = true; + if (select) + this.m_SelectedFiles.AddLast(fileNode); + else + this.m_SelectedFiles.Remove(fileNode); + + fileNode.Selected = select; } + foreach (var node in fileNode.Childrens) { - SelectNode(node); + SelectNode(node, select); + } + } + + void ExpandNode(FileNode fileNode, bool expand) + { + if (!(fileNode.isDirectory)) + return; + + fileNode.Expanded = expand; + + foreach (var node in fileNode.Childrens) + { + if (node.isDirectory) + { + ExpandNode(node, expand); + } } } @@ -297,15 +318,27 @@ private void RenderFileTree() LinkedList linkedList = new LinkedList(); linkedList.AddFirst(this.m_RootDir); LinkedList linkedList2 = new LinkedList(); - if (GUILayout.Button("Select all")) + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Expand all")) { - this.m_SelectedFiles.Clear(); foreach (var fileNode in linkedList) { - SelectNode(fileNode); + ExpandNode(fileNode, true); } } - while (linkedList.Count > 0) + + if (GUILayout.Button("Collapse all")) + { + foreach (var fileNode in linkedList) + { + ExpandNode(fileNode, false); + } + } + + GUILayout.EndHorizontal(); + + while (linkedList.Count > 0) { LinkedListNode first = linkedList.First; linkedList2.Clear(); @@ -313,8 +346,8 @@ private void RenderFileTree() GUILayout.Space((float)(20 * first.Value.Depth)); if (first.Value.isDirectory) { - GUIStyle style = "IN foldout"; - first.Value.Expanded = GUILayout.Toggle(first.Value.Expanded, GUIContent.none, style); + GUIStyle style = "IN foldout"; + first.Value.Expanded = GUILayout.Toggle(first.Value.Expanded, GUIContent.none, style); } else { @@ -332,8 +365,25 @@ private void RenderFileTree() first.Value.Selected = flag; } } - first.Value.RenderIconText(); - GUILayout.EndHorizontal(); + + first.Value.RenderIconText(); + + if (first.Value.isDirectory) + { + if (GUILayout.Button("+")) + { + SelectNode(first.Value, true); + } + + if (GUILayout.Button("-")) + { + SelectNode(first.Value, false); + } + } + + GUILayout.FlexibleSpace(); + + GUILayout.EndHorizontal(); if (first.Value.Expanded) { foreach (FileSelector.FileNode current in first.Value.SubDirectories) @@ -362,7 +412,9 @@ private void RenderSelectedFileList() GUILayout.BeginHorizontal(new GUILayoutOption[0]); value.Selected = GUILayout.Toggle(value.Selected, GUIContent.none, new GUILayoutOption[0]); value.RenderIconText(); - if (MainAssetsUtil.CanPreview && GUILayout.Button("Preview", new GUILayoutOption[0])) + GUILayout.FlexibleSpace(); + + if (MainAssetsUtil.CanPreview && GUILayout.Button("Preview", new GUILayoutOption[0])) { MainAssetsUtil.Preview(value.Name); } @@ -385,7 +437,13 @@ public void OnGUI() int num = (int)Math.Floor((double)(base.position.width / 2f)); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Label("Main Assets", EditorStyles.boldLabel, new GUILayoutOption[0]); - GUILayout.Label("Please select from the list below the main assets in your package. You should select items that you consider to be the central parts of you package, and that would showcase your package. The Asset Store will generate previews for the selected items. If you are uploading a Character, the Character prefab would be a good candidate for instance", EditorStyles.wordWrappedLabel, new GUILayoutOption[0]); + GUILayout.Label( +@"Please select from the list below the main assets in your package. +You should select items that you consider to be the central parts of your package, and that would showcase your package. +The Asset Store will generate previews for the selected items. +If you are uploading a Character, the Character prefab would be a good candidate for instance", + EditorStyles.wordWrappedLabel, new GUILayoutOption[0]); + GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.BeginVertical(new GUILayoutOption[] { diff --git a/AssetStoreToolsExtra/AssetStoreToolsExtra.csproj b/AssetStoreToolsExtra/AssetStoreToolsExtra.csproj deleted file mode 100644 index 847197f..0000000 --- a/AssetStoreToolsExtra/AssetStoreToolsExtra.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - - {C0188F1E-2DF8-4205-8AE9-11A934EDAB6F} - Debug - AnyCPU - Library - AssetStoreToolsExtra - v3.5 - 4 - Unity Full v3.5 - - - AnyCPU - - - bin\Debug\ - true - full - false - - - bin\Release\ - true - pdbonly - true - - - - - - - - {2d609dfc-c51e-4172-af19-2f9022f1c691} - AssetStoreTools - - - - - C:\Program Files\Unity\Editor\Data\Managed\UnityEditor.dll - - - C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll - - - - \ No newline at end of file diff --git a/AssetStoreToolsExtra/Properties/AssemblyInfo.cs b/AssetStoreToolsExtra/Properties/AssemblyInfo.cs deleted file mode 100644 index 4c26335..0000000 --- a/AssetStoreToolsExtra/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using UnityEngine; - -[assembly: AssemblyVersion("0.0.0.0")] -[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] -[assembly: UnityAPICompatibilityVersion("5.3.0f4")] diff --git a/README.md b/README.md index 51231aa..c8f06ff 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ An improved version of the offical Unity3D asset store tools. 1. Build project `AssetStoreTools`. 2. Copy built `AssetStoreTools.dll` to `Assets/AssetStoreTools/Editor/` and overwrite the original one. +You may delete the old `AssetStoreToolsExtra.dll`. It is not used anymore. + # Improvement * Added a __select all__ button to select all files inside the main assets folder.