I currently load C# code which I have compiled into a DLL using the Assembly class:
private void LoadAssembly()
{
try
{
Assembly loadedAssembly = Assembly.LoadFrom("E:/MyUtilities/bin/Debug/MyUtilities.dll");
System.Type type = loadedAssembly.GetType("DLLTest.MyUtilities");
FieldInfo field = type.GetField("c");
Debug.Log(field.GetValue(null));
}
catch (System.Exception e)
{
Debug.Log( e.ToString() );
}
}
This is in a Unity 5 game. It works fine.
But I want to load the class into the game's domain directly. I want to do:
Debug.Log(DLLTest.MyUtilities.c)
I do not want to use the assembly object each time to access something in the DLL. Is this possible?
Basically like merging the namespaces and classes of the assembly into the game's code base so I can use classes from the assembly like I would any class defined in the application directly.
↧