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
https://docs.vrchat.com/docs/string-loading(url), 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
Can someone share a basic example to load a url and save its content into string?
Thanks in advance
April 30, 2023, 2:32pm
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
public String solution;
public VRCUrl url=null;
private IUdonEventReceiver udonEventReceiver;
inside Void start
Debug.Log("load url "+url2);
udonEventReceiver = (IUdonEventReceiver)this;
outsiede void start
public void OnStringLoadSuccess(IVRCStringDownload result)
Debug.Log("result from url "+solution);