- Home /
GetNativeTexturePtr is not working in iOS plugin
I'm working on creating iOS plugin for saving screenshot. I'm trying to use GetNativeTexturePtr. But it didn't work. It will be NULL in the iOS plugin. I want to know how to use GetNativeTexturePtr.
Please see my code below.
// C# side
System.IntPtr ptr = _buffer.GetNativeTexturePtr(); // _buffer is RenderTexture
_SaveTextureImpl(ptr);
// Define like below.
[DllImport("__Internal")]
static private extern void _SaveTextureImpl(System.IntPtr texture);
Maybe you think that _buffer
is wrong, but I visualized it on uGUI's RawImage then it worked.
Move onto Objective-C side.
// Objective-C side.
extern "C" void _SaveTextureImpl(id<MTLTexture> texture)
{
[NativeTextureSaver saveTexture:texture];
}
My understanding is, GetNativeTexturePtr
will return the pointer of id<MTLTexture>
on iOS. So I guess that we can use the pointer as id<MTLTexture>
, but it was NULL in the plugin.
Is it my mistake? or Do I need to set up something other?
Answer by edo_m18 · Aug 27, 2019 at 01:57 AM
I have finally implemented the plugin. I've posted the plugin to GitHub. If anyone want to know how to implement the plugin, please show below link.