diff --git a/src/Packages/UnityWebBrowser/Runtime/Core/BaseUwbClientManager.cs b/src/Packages/UnityWebBrowser/Runtime/Core/BaseUwbClientManager.cs index bf194c2..b2dc62b 100644 --- a/src/Packages/UnityWebBrowser/Runtime/Core/BaseUwbClientManager.cs +++ b/src/Packages/UnityWebBrowser/Runtime/Core/BaseUwbClientManager.cs @@ -4,6 +4,7 @@ // This project is under the MIT license. See the LICENSE.md file for more details. using System; +using System.IO; using UnityEngine; namespace VoltstroStudios.UnityWebBrowser.Core @@ -25,9 +26,15 @@ public abstract class BaseUwbClientManager : MonoBehaviour /// [Tooltip("The browser client, what handles the communication between the UWB engine and Unity")] public WebBrowserClient browserClient = new(); - + private string randomCachePath; + private void Start() { + //Give random cache path for the browser client + randomCachePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.Guid.NewGuid().ToString()); + FileInfo rcpFileInfo = new FileInfo(randomCachePath); + browserClient.CachePath = rcpFileInfo; + //Start the browser client browserClient.Init(); @@ -47,6 +54,9 @@ private void FixedUpdate() private void OnDestroy() { + // Delete random assigned cache folders + Directory.Delete(randomCachePath, true); + browserClient.Dispose(); OnDestroyed(); } @@ -145,4 +155,4 @@ public void ExecuteJs(string js) #endregion } -} \ No newline at end of file +}