Home

Awesome

Unity Roslyn Demos

Unity demos with Roslyn C# compiler tools which allow you to compile and inspect C# code at runtime.

I've created couple of Unity scenes which demonstrate how to use the RoslynCodeRunner.cs which currently provides you with the following options shown on the inspector image below:

Demo creating a MonoBehaviourDemo handling Math
<img src="https://github.com/dilmerv/UnityRoslynDemos/blob/master/docs/images/UnityRoslynDemos_Inspector_1.jpg" width="250"><img src="https://github.com/dilmerv/UnityRoslynDemos/blob/master/docs/images/UnityRoslynDemos_Inspector_2.jpg" width="250">

Requirements

Unity 2021.3.8f1 or greater (This could work with earlier version but not tested yet)

Future improvements

  1. Documenting how to get Roslyn C# DLLs compiled with .NET Standard