diff --git a/Assets/Resources/OVRBuildConfig.asset b/Assets/Resources/OVRBuildConfig.asset index f2d36f8..cf5cd6c 100644 --- a/Assets/Resources/OVRBuildConfig.asset +++ b/Assets/Resources/OVRBuildConfig.asset @@ -12,6 +12,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 20553fac56ec59645857c0732b787431, type: 3} m_Name: OVRBuildConfig m_EditorClassIdentifier: - androidSDKPath: C:\Users\tvero\AppData\Local\Android\Sdk + androidSDKPath: gradlePath: jdkPath: diff --git a/Assets/Scripts/AssetsDownloader.cs b/Assets/Scripts/AssetsDownloader.cs index 0e00784..3639df8 100644 --- a/Assets/Scripts/AssetsDownloader.cs +++ b/Assets/Scripts/AssetsDownloader.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; +using System.Threading; using System.Threading.Tasks; using UnityEngine; using UnityEngine.Networking; @@ -30,6 +31,9 @@ namespace QuestAppLauncher // Rate limit in minutes const int RateLimitInMins = 5; + // Used for mutual exclusion when loading assets + static SemaphoreSlim semaphoreSlim = new SemaphoreSlim(1, 1); + /// /// Class that tracks each file downloaded. /// Used to determine whether an asset has been updated since last download. @@ -75,6 +79,9 @@ namespace QuestAppLauncher // Start background thread Task.Run(async () => { + // Mutual exclusion while loading assets + await AssetsDownloader.semaphoreSlim.WaitAsync(); + // Attach / detatch JNI. Required for any calls into JNI from background threads. AndroidJNI.AttachCurrentThread(); @@ -86,6 +93,7 @@ namespace QuestAppLauncher } finally { + AssetsDownloader.semaphoreSlim.Release(); AndroidJNI.DetachCurrentThread(); } }).ContinueWith((downloadedAssets) =>