0

I have a DLL file that contains a class that I want to use inside of my c# script in a unity project.

I recently searched about dlls and learned to create dlls and use them inside c#

this is the way i use the dll import attribute to import a method from a dll and use it inside of c#

private const string dll= "MyDllFile";

DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
static extern float percent(float percent, float of);

The main dll file that i want to work on has a custom class called Factory and i want to make an instance of that class which is inside of a dll file in my c# script.

since i don't have the factory class in my c# project, i can not write something like

DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
private static extern factory(string name);

Factory factory = Factory("myFactory");

This won't work because Factory class is a custom class.

the factory() in the dll file, returns an instance of Factory class.

Any help would be appreciated.

Amirreza Yegane
  • 315
  • 1
  • 5
  • 14

0 Answers0