Overview
To add dynamic gimmicks to VRChat worlds—like buttons that respond to player actions or doors that open automatically—you need programming through scripting. This article explains the basic concepts of UdonSharp, the tool used for this purpose.
To understand UdonSharp's role accurately, we'll first explain the underlying system called VRChat Udon, then learn why Udon is necessary and what you can achieve with UdonSharp.
The Roles of Udon and UdonSharp
UdonSharp and Udon are closely related but have distinctly different roles. Understanding the difference between these two is important when starting world creation.
VRChat Udon: A "Virtual Machine" for Executing Programs
Udon is a system itself developed by VRChat for safely executing programs within worlds. Also called the "Udon VM (Virtual Machine)," it's a virtual execution environment where all Udon programs run.
The Udon VM functions as a "sandbox" that prevents dangerous instructions from executing. This allows VRChat to safely run programs from any world without risking harm to users' PC environments.
The programming language directly interpreted by the Udon VM is called "Udon Assembly," but it's very low-level and complex for humans to write directly.
UdonSharp: A "Compiler" for Writing Udon Programs in C#
UdonSharp is a compiler that enables creating Udon programs using C#, a high-level programming language that's easier for humans to understand. A compiler is a tool that converts code written in one programming language into another language (in this case, Udon Assembly).
Creators write code in C# using UdonSharp, and UdonSharp automatically converts it to Udon Assembly, allowing the program to run on the Udon VM.

| Term | Role |
|---|---|
| Udon | A Virtual Machine (VM) for safely executing programs within VRChat |
| UdonSharp | A compiler that converts C# code to Udon Assembly |
This system allows creators to develop world gimmicks using their knowledge of the widely-used C# language without worrying about complex Udon Assembly.
Why Udon is Necessary
There are two main reasons why standard Unity C# scripts cannot be used directly in VRChat:
-
Security: Regular C# scripts have powerful capabilities, including access to the PC's file system and free communication with external servers. If malicious creators abused these, they could harm users' PCs. The restricted Udon VM environment prevents such dangerous operations and ensures platform safety.
-
Cross-platform Compatibility: VRChat runs on different operating systems and hardware, such as PC (Windows) and Meta Quest (Android). By providing a common execution environment through the Udon VM, programs created once are guaranteed to work the same way on any platform.
Examples of Features Implementable with UdonSharp
You can add various interactive features to worlds using UdonSharp.
-
Basic Interactions
- Doors that automatically open and close when players approach
- Jukeboxes that switch background music when clicked
- Flashlights that turn on when picked up
-
Game Elements
- Target shooting games that record and display scores
- Teleport portals that transport players to specific locations
- Drivable vehicles (cars, trains, etc.)
-
Social Features
- Message displays announcing player joins and leaves
- Video players that synchronize playback for everyone in the world
-
Environmental Effects
- Systems where weather or lighting changes over time
- Effects where objects flash in sync with music
These features are achieved through commands that interface with VRChat's systems (player information, network synchronization, etc.) provided by UdonSharp.
Main Limitations of UdonSharp
While UdonSharp is powerful, it has some feature restrictions for security reasons.
- No File System Access: Reading or writing to local files is not possible.
- Network Communication Restrictions: Direct communication with external websites or servers is not allowed except through VRChat-approved APIs.
- Some C# Features Unavailable: Some advanced C# features not supported by the Udon VM, such as generics (e.g.,
List<T>), cannot be used directly. However, alternative methods are available in most cases.
These limitations are essential for maintaining a secure platform. During development, you'll need to find ways to achieve your goals within these constraints.
Summary
- Udon is a Virtual Machine for safely executing programs within VRChat.
- UdonSharp is a compiler for writing Udon programs in C#.
- Ensuring security and cross-platform compatibility are the main reasons Udon is necessary.
- Using UdonSharp, you can implement a wide variety of interactive features, from buttons to games.