I am currently working on a native plugin for Unity involving other static libraries (dependencies). I have recently upgraded to Windows 10, and am running the most current Unity. I followed instructions and dropped my dll in the Plugin's folder within Assets, but when running in editor I get the error in the title. The dll fails to load and subsequent calls to imported methods gives me "file not found ". Here is my local c# referencing the dll:
public class video : MonoBehaviour {
public string videoName;
public string folder;
public bool isPlaying;
[Range(0.0f, 100.0f)]
public float videoTime;
public delegate void FrameCallback(int id, IntPtr data, int width, int height);
public FrameCallback frameHandler;
[DllImport("ffmpegForUnity")]
public static extern int initVideo(string name, string folder);
[DllImport("ffmpegForUnity")]
public static extern int setFrameCallback(FrameCallback fn);
[DllImport("ffmpegForUnity")]
public static extern void getVideoFrame();
public struct Frame
{
public int id;
public byte[] data;
public int width;
public int height;
}
Frame mFrame;
// Use this for initialization
void Start () {
//set up video context
initVideo(videoName, folder);
frameHandler = new FrameCallback(FrameHandler);
setFrameCallback(frameHandler);
}
and the header file for my dll:
#ifdef FFMPEGFORUNITY_EXPORTS
#define FFMPEGFORUNITY_API __declspec(dllexport)
#else
#define FFMPEGFORUNITY_API __declspec(dllimport)
#endif
extern "C"
{
#include
#include
#include
#include
}
using FrameCallback = void(*)(int id, uint8_t* data, int width, int height);
FrameCallback mFrameCallback = NULL;
namespace ffmpegForUnity {
class videoHandler {
public:
static FFMPEGFORUNITY_API int initVideo(char* video, char* folder);
static FFMPEGFORUNITY_API void* getVideoFrame();
static FFMPEGFORUNITY_API bool setFrameCallback(FrameCallback callbackMethod);
};
}
Has anyone run into this before? Googling has not helped. I found one other problem and the solution was to run the unity application in a visual studio simulator, but I want my plugin to be able to be used on multiple platforms, not just in the windows store.
↧