Skip to content

Instantly share code, notes, and snippets.

@JoseMiguelPizarro
Last active August 31, 2019 14:09
Show Gist options
  • Save JoseMiguelPizarro/25745817a175626bb414f80875c9f100 to your computer and use it in GitHub Desktop.
Save JoseMiguelPizarro/25745817a175626bb414f80875c9f100 to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using System;
public static class LevelMeshToolProvider
{
public static List<LevelMeshTool> tools = new List<LevelMeshTool>();
static LevelMeshToolProvider()
{
foreach (var type in GetAllTypes(AppDomain.CurrentDomain))
{
if (type.IsSubclassOf(typeof(LevelMeshTool)))
{
var t = Activator.CreateInstance(type) as LevelMeshTool;
tools.Add(t);
}
}
}
private static IEnumerable<Type> GetAllTypes(AppDomain domain)
{
foreach (var assembly in domain.GetAssemblies())
{
Type[] types = assembly.GetTypes();
foreach (var type in types)
{
yield return type;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment