String Loading
String Loading allows you to download text files from the internet and use them in your VRChat world. You can either use the DownloadString
script included in the SDK, or you can make your own script using the new VRCStringDownloader.LoadUrl
function.
- Your text files can be in any format, such as
.txt
or.json
.
- One string can be downloaded every five seconds. If this limit is exceeded, string downloads are queued and downloaded in a random order.
- One string can only be of a maximum of 100MB
- You can only have 1000 elements in the queue
Trusted URLs
If a site is not on the list, it will not download unless ‘Allow Untrusted URLs’ has been enabled in the user’s settings.
The following URLs are available:
- GitHub (
*.github.io
) - Pastebin (
pastebin.com
) - Github Gist (
gist.githubusercontent.com
)
Guides
Using the DownloadString
script to download a string
The SDK includes a script to download strings easily:
- Create a new GameObject in your scene.
- Add an
UdonBehaviour
component. - Select
DownloadString
as the program source. - Enter the URL and select the text component where you'd like to display the downloaded text.
Create your own script for LoadUrl
You can use the function VRCStringDownloader.LoadUrl
to download Strings in your own graphs.
- Execute
VRCStringDownloader.LoadUrl
with a URL and specify an UdonBehaviour. - Wait for the
OnStringLoadSuccess
orOnStringLoadError
event to be called on the specified UdonBehaviour. - Use the event's
IVRCStringDownload
to get theResult
of the string download.
New UdonGraph Nodes
New events
OnStringLoadSuccess
Returns IVRCStringDownload
. Called when the function LoadUrl
has successfully downloaded the string from the internet.
OnStringLoadError
Returns IVRCStringDownload
. Called when the function LoadUrl
has failed to download the string.
New types
VRCStringDownloader
Use this static class to download strings from the web.
VRCStringDownloader.LoadUrl
- Url: the URL to load from the internet.
- UdonBehaviour: the UdonBehaviour to send the events to.
- In Udon Graph, this defaults to the current UdonBehaviour
- In Udon Sharp, you can use
(IUdonEventReceiver)this
IVRCStringDownload
Result from the string load events.
- Get Error (
string
): The error message forOnStringLoadError
. - Get ErrorCode (
int
): The HTTP Error code forOnStringLoadError
. - Get Response (
string
): The string that was downloaded. - Get UdonBehaviour (
UdonBehaviour
): The UdonBehaviour to which events are sent. - Get Url (
VRCUrl
): Gets the URL from which the download was attempted.