Skip to content

Commit

Permalink
wtf image at the start
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonic853 committed Dec 9, 2024
1 parent 84a31ff commit babf4f7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Scripts/UrlImageLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
10 changes: 10 additions & 0 deletions Scripts/UrlSubmitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions Scripts/UrlsImageLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit babf4f7

Please sign in to comment.