Skip to content

Commit 9827063

Browse files
author
davidkline-ms
committed
pr feedback: support Shaders~ folder existing in embedded package
1 parent ea4ee78 commit 9827063

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Assets/MRTK/StandardAssets/EditorUtilities/OnLoadUtilities.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,29 @@ private static bool AssetsContainsShaders()
5353
}
5454

5555
/// <summary>
56-
/// Finds the shader folder within the package cache.
56+
/// Finds the shader folder within a in installed or embedded package.
5757
/// </summary>
5858
/// <returns>
5959
/// DirectoryInfo object representing the shader folder in the package cache.
6060
/// If not found, returns null.</returns>
6161
private static DirectoryInfo FindShaderFolderInPackage()
6262
{
63-
DirectoryInfo di = new DirectoryInfo(Path.GetFullPath(Path.Combine("Library", "PackageCache")));
64-
if (!di.Exists) { return null; }
63+
List<string> searchPaths = new List<string>
64+
{
65+
Path.GetFullPath(Path.Combine("Library", "PackageCache")),
66+
Path.GetFullPath("Packages")
67+
};
6568

66-
FileInfo[] files = di.GetFiles(ShaderSentinelFile, SearchOption.AllDirectories);
67-
if (files.Length > 0)
69+
foreach (string path in searchPaths)
6870
{
69-
return new DirectoryInfo(files[0].DirectoryName);
71+
DirectoryInfo di = new DirectoryInfo(path);
72+
if (!di.Exists) { continue; }
73+
74+
FileInfo[] files = di.GetFiles(ShaderSentinelFile, SearchOption.AllDirectories);
75+
if (files.Length > 0)
76+
{
77+
return new DirectoryInfo(files[0].DirectoryName);
78+
}
7079
}
7180

7281
return null;

0 commit comments

Comments
 (0)