Can someone share an example about how to use VRCStringDownloader.LoadUrl

Hello, I try to use VRCStringDownloader.LoadUrl in a script load a string from a url.

According docs I should use VRCStringDownloader.LoadUrl

If I add this line, How can I declare url?
I try something like this but return the error that “string can not be converted to url…”

This code obviously is not working :wink:

url ="https://....";(
the string=VRCStringDownloader.LoadUrl(url)

Can someone share a basic example to load a url and save its content into string?

Thanks in advance

You have to use string to create VRCUrl object, and use that as the URL for the get function.

Thank’s for reply…

I try this, but returns error


According to the docs, it says that the VRCUrl object cannot be constructed at runtime, so you might need to look closely at when and where your making this call. Alternatively, it says that you can use a VRCInputField to construct a VRCUrl, so that might be a thing you need to do - create a ‘hidden’ VRCInput object somewhere, set it to your URL, then call the Get() method on it to get a VRCUrl object from the return.

Thanks a lot, finally the problem was that I didn’t define IUdonEventReceiver

If it helps anyone, here is the code that works for me :wink:

public String solution;
 public VRCUrl url=null;
  private IUdonEventReceiver udonEventReceiver;

inside Void start

var url2=url.Get();
Debug.Log("load url "+url2);
 udonEventReceiver = (IUdonEventReceiver)this;
VRCStringDownloader.LoadUrl(url,udonEventReceiver );

outsiede  void start 

public void OnStringLoadSuccess(IVRCStringDownload result)
Debug.Log("result from url "+solution);
1 Like