Awesome
UdonSharp
UdonSharp is a compiler that translates C# to Udon assembly, so you can create interactive VRChat worlds by writing C# code.
You can find the full docs at https://udonsharp.docs.vrchat.com.
:warning: IMPORTANT! :warning:
The old 0.x version of UdonSharp which used to be delivered as a .unitypackage is deprecated and no longer supported. You can use the Creator Companion to migrate your projects to this new version and keep it updated moving forward.
Requirements
- Unity 2019.4.31f1
- VRChat World SDK (can be automatically resolved, see below)
Getting Started
If you're comfortable using GitHub, follow the directions in the UdonSharp Template repo to quickly make your own ready-to-use repository. Otherwise, you can download the VRChat Creator Companion, and then choose Projects > New > UdonSharp to create a new ready-to-use Unity Project.
Use Unity 2019.4.31.f1 to open the project. Press "OK" on the dialog that offers to download the required VRChat packages.
Loading the Example World
Find the "VRChat SDK" item in the menu bar at the top of the Unity Editor window, press it to open, then choose "Samples > UdonExampleScene".
Once the scene opens, choose "File > Save As..." and give the scene a new name.
Then modify the scene however you'd like - you learn about all the examples in the UdonExampleScene or learn about Getting Started with Udon.
Making your own Scripts
-
Make a new object in your scene
-
Add an
Udon Behaviour
component to your object -
Below the "New Program" button click the dropdown and select "Udon C# Program Asset"
-
Now click the New Program button, this will create a new UdonSharp program asset for you
-
Click the Create Script button and choose a save destination and name for the script.
-
This will create a template script that's ready for you to start working on, open the script in your editor of choice and start programming.
Instead of creating assets from an UdonBehaviour you can also do the following:
-
Right-click in your project asset explorer
-
Navigate to Create > U# script
-
Click U# script, this will open a create file dialog
-
Choose a name for your script and click Save
-
This will create a .cs script file and an UdonSharp program asset that's set up for the script in the same directory
Test Your World
When you're ready to try out your World, find and choose the menu item "VRChat SDK > Show Control Panel".
- Sign into your VRChat Account in the "Authentication" tab.
- Switch to the "Builder" tab and choose "Build & Test".
- After a quick build process, VRChat should open up in your test world!
- If you have any issues making a test world, check out our docs on Using Build & Test.
Publish Your World
When you're ready to publish your World so you can use it regularly:
- Return to the VRChat SDK Control Panel in your Unity Project
- Switch to the "Builder" tab and press "Build and Publish for Windows".
- This will build your World and add some publishing options to your Game window.
- Fill out the fields "World Name", "Description" and "Sharing", and check the terms box "the above information is accurate...".
- Press "Upload".
Return to VRChat - open the "Worlds" menu, then scroll down to the section named "Mine". Choose your world from the list and press "Go" to check it out!
Visual Studio Code Integration
You can follow this video guide to get Intellisense for C# within your Unity project in Visual Stido Code (VS Code), inlcuding libraries such as UdonSharp.
Credits
- See CONTRIBUTORS.md for people who have helped provide improvments to UdonSharp
- The open source project Harmony helps Udonsharp provide a better editor experience