Skip to content

Commit 6b761e5

Browse files
committed
updated docs and fixed public/internal changes from merge.
1 parent ae38ea3 commit 6b761e5

File tree

7 files changed

+61
-53
lines changed

7 files changed

+61
-53
lines changed

Documentation/com.unity.assetbundlebrowser.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ The Build tab provides basic build functionality to get you started using asset
157157
# Usage - Inspect
158158
This tab enables you to inspect the contents of bundles that have already been built.
159159
### Usage
160-
* Type in a bundle path, or find one using the 'Browse' button.
160+
* If you use the Browser to build, then the path you built to will automatically be added here.
161+
* Click "Add File" or "Add Folder" to add bundles to inspect.
162+
* Click the "-" next to each row to remove that file or folder. Note, you cannot remove individual files that were added by adding a folder.
161163
* Select any bundle listed to see details:
162164
* Name
163165
* Size on disk
164-
* Preload Table - full contents of bundle
165-
* Container - only explicitly added items
166-
* Dependencies - bundles that the current bundle depends on
166+
* Source Asset Paths - the assets explicitly added to this bundle. Note this list is incomplete for scene bundles.
167+
* Advanced Data - includes information on the Preload Table, Container (explicit assets) and Dependencies.

Editor/AssetBundleDataSource/ABDataSource.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using UnityEditor;
2+
using System;
23

34
namespace AssetBundleBrowser.AssetBundleDataSource
45
{
@@ -19,6 +20,10 @@ public partial struct ABBuildInfo
1920
/// Target platform for build.
2021
/// </summary>
2122
public BuildTarget buildTarget;
23+
/// <summary>
24+
/// Callback for build event.
25+
/// </summary>
26+
public Action<string> onBuild;
2227
}
2328

2429
/// <summary>

Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace AssetBundleBrowser.AssetBundleDataSource
1010
{
1111
internal class AssetDatabaseABDataSource : ABDataSource
1212
{
13-
internal static List<ABDataSource> CreateDataSources()
13+
public static List<ABDataSource> CreateDataSources()
1414
{
1515
var op = new AssetDatabaseABDataSource();
1616
var retList = new List<ABDataSource>();
@@ -79,6 +79,12 @@ public bool CanSpecifyBuildOptions {
7979

8080
public bool BuildAssetBundles (ABBuildInfo info) {
8181
var buildManifest = BuildPipeline.BuildAssetBundles(info.outputDirectory, info.options, info.buildTarget);
82+
if (buildManifest == null)
83+
{
84+
Debug.Log("Error in build");
85+
return false;
86+
}
87+
8288
foreach(var assetBundleName in buildManifest.GetAllAssetBundles())
8389
{
8490
if (info.onBuild != null)

Editor/InspectTab/AssetBundleInspectTab.cs

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
using UnityEditor;
2+
using UnityEngine;
23
using UnityEditor.IMGUI.Controls;
34
using System.Collections.Generic;
45
using System.IO;
56
using System.Runtime.Serialization.Formatters.Binary;
67
using System.Linq;
78

8-
namespace UnityEngine.AssetBundles
9+
namespace AssetBundleBrowser
910
{
1011
[System.Serializable]
11-
public class AssetBundleInspectTab
12+
internal class AssetBundleInspectTab
1213
{
1314
Rect m_Position;
1415
[SerializeField]
@@ -23,7 +24,7 @@ public class AssetBundleInspectTab
2324
[SerializeField]
2425
private TreeViewState m_BundleTreeState;
2526

26-
public Editor m_Editor = null;
27+
internal Editor m_Editor = null;
2728

2829
private SingleBundleInspector m_SingleInspector;
2930

@@ -52,14 +53,14 @@ private AssetBundleRecord GetLoadedBundleRecordByName(string bundleName)
5253
return m_loadedAssetBundles[bundleName];
5354
}
5455

55-
public AssetBundleInspectTab()
56+
internal AssetBundleInspectTab()
5657
{
5758
m_BundleList = new Dictionary<string, List<string>>();
5859
m_SingleInspector = new SingleBundleInspector();
5960
m_loadedAssetBundles = new Dictionary<string, AssetBundleRecord>();
6061
}
6162

62-
public void OnEnable(Rect pos, EditorWindow parent)
63+
internal void OnEnable(Rect pos, EditorWindow parent)
6364
{
6465
m_Position = pos;
6566
if (m_Data == null)
@@ -92,7 +93,7 @@ public void OnEnable(Rect pos, EditorWindow parent)
9293
RefreshBundles();
9394
}
9495

95-
public void OnDisable()
96+
internal void OnDisable()
9697
{
9798
ClearData();
9899

@@ -107,7 +108,7 @@ public void OnDisable()
107108
file.Close();
108109
}
109110

110-
public void OnGUI(Rect pos)
111+
internal void OnGUI(Rect pos)
111112
{
112113
m_Position = pos;
113114

@@ -152,12 +153,12 @@ private void OnGUIEditor()
152153
}
153154
}
154155

155-
public void RemoveBundlePath(string pathToRemove)
156+
internal void RemoveBundlePath(string pathToRemove)
156157
{
157158
UnloadBundle(pathToRemove);
158159
m_Data.RemovePath(pathToRemove);
159160
}
160-
public void RemoveBundleFolder(string pathToRemove)
161+
internal void RemoveBundleFolder(string pathToRemove)
161162
{
162163
List<string> paths = null;
163164
if(m_BundleList.TryGetValue(pathToRemove, out paths))
@@ -203,7 +204,7 @@ private void BrowseForFolder(string folderPath = null)
203204
}
204205
}
205206

206-
public void AddBundleFolder(string folderPath)
207+
internal void AddBundleFolder(string folderPath)
207208
{
208209
m_Data.AddFolder(folderPath);
209210
}
@@ -224,7 +225,7 @@ private void ClearData()
224225
}
225226
}
226227

227-
public void RefreshBundles()
228+
internal void RefreshBundles()
228229
{
229230
ClearData();
230231

@@ -310,11 +311,11 @@ private void AddFilePathToList(string rootPath, string path)
310311
}
311312
}
312313

313-
public Dictionary<string, List<string>> BundleList
314+
internal Dictionary<string, List<string>> BundleList
314315
{ get { return m_BundleList; } }
315316

316317

317-
public void SetBundleItem(IList<InspectTreeItem> selected)
318+
internal void SetBundleItem(IList<InspectTreeItem> selected)
318319
{
319320
//m_SelectedBundleTreeItems = selected;
320321
if (selected == null || selected.Count == 0 || selected[0] == null)
@@ -342,17 +343,17 @@ public void SetBundleItem(IList<InspectTreeItem> selected)
342343
}
343344

344345
[System.Serializable]
345-
public class InspectTabData
346+
internal class InspectTabData
346347
{
347348
[SerializeField]
348349
private List<string> m_BundlePaths = new List<string>();
349350
[SerializeField]
350351
private List<BundleFolderData> m_BundleFolders = new List<BundleFolderData>();
351352

352-
public IList<string> BundlePaths { get { return m_BundlePaths.AsReadOnly(); } }
353-
public IList<BundleFolderData> BundleFolders { get { return m_BundleFolders.AsReadOnly(); } }
353+
internal IList<string> BundlePaths { get { return m_BundlePaths.AsReadOnly(); } }
354+
internal IList<BundleFolderData> BundleFolders { get { return m_BundleFolders.AsReadOnly(); } }
354355

355-
public void AddPath(string newPath)
356+
internal void AddPath(string newPath)
356357
{
357358
if (!m_BundlePaths.Contains(newPath))
358359
{
@@ -368,29 +369,29 @@ public void AddPath(string newPath)
368369
}
369370
}
370371

371-
public void AddFolder(string newPath)
372+
internal void AddFolder(string newPath)
372373
{
373374
if (!BundleFolderContains(newPath))
374375
m_BundleFolders.Add(new BundleFolderData(newPath));
375376
}
376377

377-
public void RemovePath(string pathToRemove)
378+
internal void RemovePath(string pathToRemove)
378379
{
379380
m_BundlePaths.Remove(pathToRemove);
380381
}
381382

382-
public void RemoveFolder(string pathToRemove)
383+
internal void RemoveFolder(string pathToRemove)
383384
{
384385
m_BundleFolders.Remove(BundleFolders.FirstOrDefault(bfd => bfd.Path == pathToRemove));
385386
}
386387

387-
public bool FolderIgnoresFile(string folderPath, string filePath)
388+
internal bool FolderIgnoresFile(string folderPath, string filePath)
388389
{
389390
var bundleFolderData = BundleFolders.FirstOrDefault(bfd => bfd.Path == folderPath);
390391
return bundleFolderData != null && bundleFolderData.IgnoredFiles.Contains(filePath);
391392
}
392393

393-
public BundleFolderData FolderDataContainingFilePath(string filePath)
394+
internal BundleFolderData FolderDataContainingFilePath(string filePath)
394395
{
395396
foreach (var bundleFolderData in BundleFolders)
396397
{
@@ -415,13 +416,13 @@ private bool BundleFolderContains(string folderPath)
415416
}
416417

417418
[System.Serializable]
418-
public class BundleFolderData
419+
internal class BundleFolderData
419420
{
420-
public string Path;
421+
internal string Path;
421422

422-
public IList<string> IgnoredFiles;
423+
internal IList<string> IgnoredFiles;
423424

424-
public BundleFolderData(string path)
425+
internal BundleFolderData(string path)
425426
{
426427
Path = path;
427428
IgnoredFiles = new List<string>();

Editor/InspectTab/AssetBundleRecord.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Collections;
2-
using System.Collections.Generic;
3-
using UnityEngine;
1+
using UnityEngine;
42

53
namespace AssetBundleBrowser
64
{

Editor/InspectTab/InspectSingleBundle.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
using UnityEditor;
2-
using UnityEditor.IMGUI.Controls;
3-
using System.Collections.Generic;
2+
using UnityEngine;
43
using System.IO;
5-
using System;
64

7-
namespace UnityEngine.AssetBundles
5+
namespace AssetBundleBrowser
86
{
97
class SingleBundleInspector
108
{
11-
public static string currentPath { get; set; }
9+
internal static string currentPath { get; set; }
1210

1311

14-
public SingleBundleInspector() { }
12+
internal SingleBundleInspector() { }
1513

1614
private Editor m_Editor = null;
1715

@@ -23,7 +21,7 @@ public SingleBundleInspector() { }
2321
private AssetBundleInspectTab m_assetBundleInspectTab = null;
2422
private AssetBundleInspectTab.InspectTabData m_inspectTabData = null;
2523

26-
public void SetBundle(AssetBundle bundle, string path = "", AssetBundleInspectTab.InspectTabData inspectTabData = null, AssetBundleInspectTab assetBundleInspectTab = null)
24+
internal void SetBundle(AssetBundle bundle, string path = "", AssetBundleInspectTab.InspectTabData inspectTabData = null, AssetBundleInspectTab assetBundleInspectTab = null)
2725
{
2826
//static var...
2927
currentPath = path;
@@ -38,7 +36,7 @@ public void SetBundle(AssetBundle bundle, string path = "", AssetBundleInspectTa
3836
}
3937
}
4038

41-
public void OnGUI(Rect pos)
39+
internal void OnGUI(Rect pos)
4240
{
4341
m_Position = pos;
4442

@@ -79,10 +77,10 @@ private void DrawBundleData()
7977
}
8078

8179
[CustomEditor(typeof(AssetBundle))]
82-
public class AssetBundleEditor : Editor
80+
internal class AssetBundleEditor : Editor
8381
{
84-
public bool pathFoldout = false;
85-
public bool advancedFoldout = false;
82+
internal bool pathFoldout = false;
83+
internal bool advancedFoldout = false;
8684
public override void OnInspectorGUI()
8785
{
8886
AssetBundle bundle = target as AssetBundle;

Editor/InspectTab/InspectTreeView.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
using UnityEditor;
1+
using UnityEngine;
22
using UnityEditor.IMGUI.Controls;
33
using System.Collections.Generic;
4-
using System.IO;
54
using System.Linq;
65

7-
namespace UnityEngine.AssetBundles
6+
namespace AssetBundleBrowser
87
{
9-
public class InspectTreeItem : TreeViewItem
8+
internal class InspectTreeItem : TreeViewItem
109
{
11-
public string bundlePath { get; private set; }
10+
internal string bundlePath { get; private set; }
1211

13-
public InspectTreeItem(string path, int depth) : base(path.GetHashCode(), depth, path)
12+
internal InspectTreeItem(string path, int depth) : base(path.GetHashCode(), depth, path)
1413
{
1514
bundlePath = path;
1615
}
17-
public InspectTreeItem(string path, int depth, string prettyName) : base(path.GetHashCode(), depth, prettyName)
16+
internal InspectTreeItem(string path, int depth, string prettyName) : base(path.GetHashCode(), depth, prettyName)
1817
{
1918
bundlePath = path;
2019
}
@@ -23,7 +22,7 @@ public InspectTreeItem(string path, int depth, string prettyName) : base(path.Ge
2322
class InspectBundleTree : TreeView
2423
{
2524
AssetBundleInspectTab m_InspectTab;
26-
public InspectBundleTree(TreeViewState s, AssetBundleInspectTab parent) : base(s)
25+
internal InspectBundleTree(TreeViewState s, AssetBundleInspectTab parent) : base(s)
2726
{
2827
m_InspectTab = parent;
2928
showBorder = true;

0 commit comments

Comments
 (0)