Skip to content

Commit d899e7f

Browse files
authored
Editor code points to Assets/Samples/ManageXR Unity SDK (#217)
Files.zip deleted, users now don't have to extract it to populate sample data, they can install the samples via the package manager.
2 parents 8196b60 + 8caf85b commit d899e7f

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

Assets/MXR.SDK/Files.zip

-10.6 MB
Binary file not shown.

Assets/MXR.SDK/Files.zip.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

Assets/MXR.SDK/Runtime/Editor/MXREditorSystem.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,9 @@ void WriteWifiConnectionStatus() {
510510
}
511511

512512
string GetFilePath(string fileName) {
513-
var filesPath = Path.Combine(Application.dataPath.Replace("Assets", "Files"));
514-
if (!Directory.Exists(filesPath))
515-
throw new DirectoryNotFoundException("Ensure Files/ directory inside Unity project");
516-
var mightyDir = Path.Combine(filesPath, "MightyImmersion");
513+
var mightyDir = Path.Combine(MXRStorage.ExternalStorageDirectory, "MightyImmersion");
517514
if (!Directory.Exists(mightyDir))
518-
throw new DirectoryNotFoundException("Ensure Files/MightyImmersion directory inside Unity project");
515+
throw new DirectoryNotFoundException("Ensure MightyImmersion directory exists in ManageXR Unity SDK Samples");
519516
return Path.Combine(mightyDir, fileName);
520517
}
521518

Assets/MXR.SDK/Runtime/Utils/MXRStorage.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,20 @@ public static class MXRStorage {
1212
/// </summary>
1313
public static string ExternalStorageDirectory {
1414
get {
15-
if (Application.isEditor)
16-
return Application.dataPath.Replace("Assets", "Files");
15+
if (Application.isEditor) {
16+
var samplesPath = Path.Combine(Application.dataPath, "Samples", "ManageXR Unity SDK");
17+
if (!Directory.Exists(samplesPath))
18+
throw new System.Exception($"No ManageXR Unity SDK Samples found in the project");
19+
var dirs = Directory.GetDirectories(samplesPath, "*", SearchOption.TopDirectoryOnly);
20+
21+
foreach(var dir in dirs) {
22+
var target = Path.Combine(dir, "Samples", "Files");
23+
if (Directory.Exists(target)) {
24+
return target;
25+
}
26+
}
27+
throw new System.Exception($"No ManageXR Unity SDK Samples found in the project");
28+
}
1729
else {
1830
var path = new AndroidJavaClass("android.os.Environment")
1931
.SafeCallStatic<AndroidJavaObject>("getExternalStorageDirectory")

0 commit comments

Comments
 (0)