Is there any documentation explaining how to create a simple .NET dll and use it with Unity? Thanks!
Red, do you know how to make a DLL? What is your starting point skill-wise?
The Unity-specific part of it is easy: once you have a .dll file, just drop it anywhere in your Assets folder. There’s lots of information on the net about how to compile .NET code into a DLL (refered to as an ‘assembly’ in .NET parlance), but the specifics depend on what tools you want to use – Visual Studio / MonoDevelop / command-line / etc.
I have written the following test dll,
using System;
using System.IO;
namespace TestDLL
{
public class MyClass
{
public MyClass ()
{
}
public void test()
{
StreamWriter sw = File.CreateText(@"c:\\test.txt");
sw.WriteLine("This worked!");
sw.Close();
}
}
}
How can I invoke the test function in a unity javascript? Thanks!
The UnityScript counterpart to “using” is @import. Import the TestDLL namespace and use MyClass like any other class
Thanks Dreamora. What directory should I put my dll in? Thanks!
Ah I got it. The asset folder. Thanks!