Dev Asset Collection

All Things That You Need to Build A Video Game
Menu
  • 2D
    • Characters
    • Environments
    • Fonts
    • GUI
    • Textures & Materials
  • 3D
    • Animations
    • Characters
    • Environments
    • GUI
    • Props
    • Vegetation
    • Vehicles
  • Add-Ons
    • Machine Learning
    • Services
  • Audio
    • Ambient
    • Music
    • Sound FX
  • Essentials
    • Tutorial Projects
  • Templates
    • Packs
    • Systems
    • Tutorials
  • Tools
    • AI
    • Animation
    • Audio
    • Camera
    • Game Toolkits
    • GUI
    • Input Management
    • Integration
    • Level Design
    • Localization
    • Modeling
    • Network
    • Painting
    • Particles & Effects
    • Physics
    • Sprite Management
    • Terrain
    • Utilities
    • Version Control
    • Video
    • Visual Scripting
  • VFX
    • Particles
    • Shaders
Home
Tools
Utilities
Roslyn C# – Runtime Compiler 2.0 – Dev Community

Roslyn C# – Runtime Compiler 2.0 – Dev Community

Tsunami 31 December, 2025
Sending
User Rating 0 (0 votes)

Roslyn C# allows you to compile and load C# source code at runtime using the .Net compiler platform, making it easy to add mod support, in-game coding, extensibility and much more to your game.

Roslyn C# – Runtime Compiler 2.0 v2.3.0 (27 Nov 2025) (Latest version)

VIP Only

“Sharing is caring”

Description
NOTE – Requires desktop platform with Mono backend by default, but other platforms and IL2CPP support is possible with limitations using a free addon as described here.

Roslyn C# is a fully featured compiler and runtime API for compiling, loading and executing external C# source code and managed assemblies (.dll) as part of your game. The asset aims to simply the process of compiling and loading code by providing simple but powerful API’s to compile from source strings, files, syntax trees, C# projects and folders. Additionally there are async variants provided for all compile API’s so that your game can continue to run while compiling occurs in the background.

Forum | Discord | Documentation | Scripting Reference | Samples | FAQ | Support

Code Security

One of the main problems with loading external code (In the case of modding for example) is the possiblity for the code to be potentially harmful if it may have come from an untrusted source. Roslyn C# has you covered in this regard with the code security feature.

All code loaded via Roslyn C# has our proprietary code security system perform static anaysis of the IL bytecode to search for potentially harmful features. By creating custom code validation rules you can detect and prevent loading of an assembly if it includes references to illegal assemblies, namespaces, types, or uses unsafe contexts or platform invokes. The system will report every occurrence of a reference that is deemed illegal and output a detailed report to help the user fix security issues if they arrise.

Execution Security

New feature for version 2.0 of the asset!

Another issue with running external or user input source code is that the game has no ability to control the execution of such code, meaning that the code could potentially crash the host game if an infinite loop is written either maliciously or by mistake. A normal solution to this problem could be to run the user code on a background thread, however that becomes an issue if the user code needs to access the Unity API, which can only be done from the main thread.

For version 2.0 of the asset we have addressed this issue by injecting runtime security checks into compiled code that will throw an exception if a loop has exectured for X amount of time or X iterations. It means that the game can recover gracefully if and infinite loop is entred, and the game will only hang for a couple fof seconds before continuing rather than crashing the app.

Features

Compile and Load C# scripts at runtime
Use the latest C# language features
Fast execution – Once compiled, external code will run as fast as game code
Simple and easy to use API for assembly, type and instance reflection
Support for non-concrete communication using script proxies
Automatic type construction using correct method (AddComponent, CreateInstance, new)
Code security validation means that unsafe code can be identified and discarded
Code security generates a detailed report upon failure containing information about illegal types used and every usage occurrence in the external code
Execution security ensures that loaded code cannot crash the host game with long or infinite loops
Fully commented C# source code included
Comprehensive documentation of the API for quick and easy reference

Prev Article
Next Article

Related Articles

Peek and Bookmark – Editor Toolkit – Dev Community
Tsunami 7 February, 2025

Peek and Bookmark – Editor Toolkit – Dev Community

Build Report Tool – Dev Community
Tsunami 29 December, 2025

Build Report Tool – Dev Community

Enviro World Components – Dev Community
Tsunami 25 April, 2022

Enviro World Components – Dev Community

AutoLOD – Impostors – Dev Community
Tsunami 4 March, 2024

AutoLOD – Impostors – Dev Community

Leave a Reply Cancel Reply

Recent Posts

  • Drive In VR – Free Download
  • Shadow Ultimate MegaPack – 12 Families + Boss – 39 Characters + Animations – Free Download
  • Game VFX Mega Pack (URP) – Free Download
  • Realistic Car Controller Pro – Dev Community
  • Jigsaw Puzzle – Customize And Create – Dev Community

Dev Asset Collection

All Things That You Need to Build A Video Game
Copyright © 2026 Dev Asset Collection
Privacy Policy | Disclaimer | DMCA