Save a Unity generated texture as MTLTexture in native
This project is a plugin of Unity. It is purpose to save a texture generated by Unity in native.
How to use
Plugin/iOS/ folder to your project in your plugin folder. You might also use
NativeTextureSaver.cs. It is good start point to use or to custom this plugin.
Main implementation of this plugin is
void _SaveTextureImpl(unsigned char* mtlTexture, const char* objectName, const char* methodName).
Define the function in any class you want to use it. That like below.
using System.Runtime.InteropServices; // Needs this to use "DllImport". [DllImport("__Internal")] static private extern void _SaveTextureImpl(System.IntPtr texture, string objectName, string methodName);
Then, you can call the function as C# method like below.
// You need setting up a render texture before use it. _SaveTextureImpl(_renderTexture.GetNativeTexturePtr(), gameObject.name, nameof(CallbackMethod));