Skip to content

Commit cace890

Browse files
committed
serialization fix for inspect tab to prevent occasional blank window on-open
1 parent 9679833 commit cace890

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this package will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [1.3.0] - 2018-1-08
8+
- serialization fix for inspect tab (was causing entire window to potentially be blank).
9+
- documentation fix
10+
711
## [1.2.0] - 2017-12-08
812
- Added asmdef to keep browser in its own assembly
913
- minor null check fixes

Editor/InspectTab/AssetBundleInspectTab.cs

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ internal void RefreshBundles()
259259

260260
foreach(var folder in m_Data.BundleFolders)
261261
{
262-
if(Directory.Exists(folder.Path))
262+
if(Directory.Exists(folder.path))
263263
{
264-
AddFilePathToList(folder.Path, folder.Path);
264+
AddFilePathToList(folder.path, folder.path);
265265
}
266266
else
267267
{
268268
Debug.Log("Expected folder not found: " + folder);
269-
pathsToRemove.Add(folder.Path);
269+
pathsToRemove.Add(folder.path);
270270
}
271271
}
272272
foreach (var path in pathsToRemove)
@@ -364,7 +364,7 @@ internal void AddPath(string newPath)
364364
}
365365
else
366366
{
367-
possibleFolderData.IgnoredFiles.Remove(newPath);
367+
possibleFolderData.ignoredFiles.Remove(newPath);
368368
}
369369
}
370370
}
@@ -382,20 +382,22 @@ internal void RemovePath(string pathToRemove)
382382

383383
internal void RemoveFolder(string pathToRemove)
384384
{
385-
m_BundleFolders.Remove(BundleFolders.FirstOrDefault(bfd => bfd.Path == pathToRemove));
385+
m_BundleFolders.Remove(BundleFolders.FirstOrDefault(bfd => bfd.path == pathToRemove));
386386
}
387387

388388
internal bool FolderIgnoresFile(string folderPath, string filePath)
389389
{
390-
var bundleFolderData = BundleFolders.FirstOrDefault(bfd => bfd.Path == folderPath);
391-
return bundleFolderData != null && bundleFolderData.IgnoredFiles.Contains(filePath);
390+
if (BundleFolders == null)
391+
return false;
392+
var bundleFolderData = BundleFolders.FirstOrDefault(bfd => bfd.path == folderPath);
393+
return bundleFolderData != null && bundleFolderData.ignoredFiles.Contains(filePath);
392394
}
393395

394396
internal BundleFolderData FolderDataContainingFilePath(string filePath)
395397
{
396398
foreach (var bundleFolderData in BundleFolders)
397399
{
398-
if (Path.GetFullPath(filePath).StartsWith(Path.GetFullPath(bundleFolderData.Path)))
400+
if (Path.GetFullPath(filePath).StartsWith(Path.GetFullPath(bundleFolderData.path)))
399401
{
400402
return bundleFolderData;
401403
}
@@ -407,7 +409,7 @@ private bool BundleFolderContains(string folderPath)
407409
{
408410
foreach(var bundleFolderData in BundleFolders)
409411
{
410-
if(Path.GetFullPath(bundleFolderData.Path) == Path.GetFullPath(folderPath))
412+
if(Path.GetFullPath(bundleFolderData.path) == Path.GetFullPath(folderPath))
411413
{
412414
return true;
413415
}
@@ -418,14 +420,24 @@ private bool BundleFolderContains(string folderPath)
418420
[System.Serializable]
419421
internal class BundleFolderData
420422
{
421-
internal string Path;
423+
[SerializeField]
424+
internal string path;
422425

423-
internal IList<string> IgnoredFiles;
426+
[SerializeField]
427+
private List<string> m_ignoredFiles;
428+
internal List<string> ignoredFiles
429+
{
430+
get
431+
{
432+
if (m_ignoredFiles == null)
433+
m_ignoredFiles = new List<string>();
434+
return m_ignoredFiles;
435+
}
436+
}
424437

425-
internal BundleFolderData(string path)
438+
internal BundleFolderData(string p)
426439
{
427-
Path = path;
428-
IgnoredFiles = new List<string>();
440+
path = p;
429441
}
430442
}
431443
}

Editor/InspectTab/InspectSingleBundle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ private void DrawBundleData()
6565
var possibleFolderData = m_inspectTabData.FolderDataContainingFilePath(currentPath);
6666
if (possibleFolderData != null)
6767
{
68-
if (!possibleFolderData.IgnoredFiles.Contains(currentPath))
69-
possibleFolderData.IgnoredFiles.Add(currentPath);
68+
if (!possibleFolderData.ignoredFiles.Contains(currentPath))
69+
possibleFolderData.ignoredFiles.Add(currentPath);
7070

7171
if(m_assetBundleInspectTab != null)
7272
m_assetBundleInspectTab.RefreshBundles();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.unity.assetbundlebrowser",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"unity": "2018.1",
55
"description": "Editor tool used to manually manage Asset Bundle configuration.",
66
"keywords": ["asset", "bundle", "bundles", "assetbundles"],

0 commit comments

Comments
 (0)