Skip to content

Instantly share code, notes, and snippets.

View MarcoMeter's full-sized avatar

Marco Pleines MarcoMeter

View GitHub Profile
@MarcoMeter
MarcoMeter / AssemblyLoader.cs
Last active September 2, 2019 19:01
This Editor Extenstion allows users to right-click on directories inside the Assets folder to compile their CSharp source files to an assembly. That assembly can be loaded and executed on run-time. Be aware that the .net Version has to be set to 2.0 inside the PlayerSettings of Unity.
using UnityEngine;
public class AssemblyLoader : MonoBehaviour
{
void Start ()
{
var assembly = System.Reflection.Assembly.LoadFrom("BCD.dll");
var typeA = assembly.GetType("TriangleBehavior");
gameObject.AddComponent(typeA);
}