关于 Unity控制佳能单反拍照及数据获取。
Unity控制佳能实时画面。
我发现在Editor里面运行 没有任何问题,
但是一旦打包出PC端,运行exe会在:
//create stream to image
unsafe { ums = new UnmanagedMemoryStream((byte*)jpgPointer.ToPointer(), (long)length, (long)length, FileAccess.Read); }
//把unmanageedMemoryStream类型的ums转成Bitmap
TextureBitmap = new Bitmap(ums, true);
ms = new MemoryStream();
//用System.Drawing.Bitmap的方法将Bitmap转成MemoryStream
TextureBitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
//将MemoryStream转成Bytes
TextureBytes = ms.GetBuffer();
TextureBitmap = new Bitmap(ums, true);
这一段 抛出异常System.TypeInitializationException: the type Initializer for ManagedToNative