diff --git a/Scripts/UrlImageLoader.cs b/Scripts/UrlImageLoader.cs index fcdb7ee..b9f8846 100644 --- a/Scripts/UrlImageLoader.cs +++ b/Scripts/UrlImageLoader.cs @@ -14,11 +14,20 @@ public class UrlImageLoader : UrlLoaderCore public Texture2D content; VRCImageDownloader _imageDownloader; public Texture2D[] cacheContents; + bool useUpdateDownload = false; void Start() { _imageDownloader = new VRCImageDownloader(); if (loadOnStart) { + useUpdateDownload = true; + } + } + void Update() + { + if (useUpdateDownload) + { + useUpdateDownload = false; LoadUrl(); } } diff --git a/Scripts/UrlSubmitter.cs b/Scripts/UrlSubmitter.cs index c8a39e0..e844f39 100644 --- a/Scripts/UrlSubmitter.cs +++ b/Scripts/UrlSubmitter.cs @@ -14,10 +14,20 @@ public class UrlSubmitter : UdonSharpBehaviour public string sendCustomEvent = "SendFunction"; public string setVariableName = "value"; public bool startOnLoad = false; + public bool useUpdate = false; void Start() { if (startOnLoad) SubmitUrl(); } + void Update() + { + if (useUpdate) + { + useUpdate = false; + SubmitUrl(); + } + } + public void SubmitUrlWithUpdate() => useUpdate = true; public void SubmitUrl() { if (!string.IsNullOrEmpty(url.ToString())) UrlLoader.PushUrl(url, udonSendFunction, sendCustomEvent, setVariableName); diff --git a/Scripts/UrlsImageLoader.cs b/Scripts/UrlsImageLoader.cs index 7f70171..cb73996 100644 --- a/Scripts/UrlsImageLoader.cs +++ b/Scripts/UrlsImageLoader.cs @@ -13,11 +13,20 @@ public class UrlsImageLoader : UrlsLoaderCore { VRCImageDownloader _imageDownloader; public Texture2D[] cacheContents; + bool useUpdateDownload = false; void Start() { _imageDownloader = new VRCImageDownloader(); if (urls.Length > 0) + useUpdateDownload = true; + } + void Update() + { + if (useUpdateDownload) + { + useUpdateDownload = false; LoadUrl(); + } } public override void LoadUrl() => LoadUrl(needReloads[0]); public override void LoadUrl(bool reload = false) diff --git a/package.json b/package.json index 06172ec..067c657 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.sonic853.udonlab.urlloader", - "version": "2.0.2", + "version": "2.0.3", "displayName": "Udon Lab - Udon Url Loader", "description": "The Udon Lab", "unity": "2022.3",