Runtime C# Scripting in Unity UI - The Roslyn Compiler in Unity @WorldOfZeroDevelopment
Runtime C# Scripting in Unity UI - The Roslyn Compiler in Unity  @WorldOfZeroDevelopment
Uploaded February 2020 | Updated November 2026, 2 hours ago
Lets integrate the .NET Roslyn compiler into a Unity game so we can run basic scripts at runtime. This will allow us to write new C# code into a Unity UI object like a `Text Box` and then execute it. The goal here is exposing our script processor to something we can interact with outside of the Unity Editor.

We'll be exploring this inside of a compiled Unity game running on Windows (compatibility of this solution on other platforms may not be as easy).

This project uses the Roslyn Scripting API (`Microsoft.CodeAnalysis.CSharp.Scripting`). There are more examples of that here: github.com/dotnet/roslyn/wiki/Scripting-API-Samples

Join the World of Zero Discord Server: discord.gg/hU5Kq2u
Runtime C# Scripting in Unity UI - The Roslyn Compiler in UnityUsing ContextMenu and ContextMenuItem in Unity 3DSwinging with the Asteroids VR Grappling Hook - Part 2Using Bash .bashrc and .profile Files to Initialize Your TerminalBuilding a Custom Dice Model with OpenSCADSpherical Gravity in UnityRotating the Flight Controller - Lets Make a Side Scrolling Shooter - Part 2Validate Unity Inspector Input with OnValidate - Quick TipRunning a Minecraft Server in DockerCreating a Context Menu in Custom Unity EditorsGetting Started with Pathfinding using Dijkstras AlgorithmLearning to Deserialize YAML in C# with YamlDotNET
World of Zero |

Runtime C# Scripting in Unity UI - The Roslyn Compiler in Unity

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER