- Home /
How do I get the Metal device for IOS within a native plugin?
I'm making an existing (pre 5.3) plugin compatible with the later unity plugin format. I have it working for Android and PC but in the sample plugin there is only D3D9, D3D11,D3D12 devices queryable. In a plugin for ios how do I query for the Metal device?
Is this what you are looking for? http://docs.unity3d.com/ScriptReference/iOS.DeviceGeneration.html
No, not what type of ios device it is. It's device as in D3D device, the rendering context to pass to the native functions that require it.
Answer by phil_me_up · Jan 18, 2016 at 01:48 PM
If you're talking about obj-c, then you can query if metal is supported by using something like the answer posted here: http://stackoverflow.com/questions/29790663/ios-code-to-identify-metal-support-in-runtime
Note that in unity terms, if you have specified Metal as a Graphics API, then metal will be used as long as the device supports it, in which case querying for the device generation might be what you want.
You can also query the System.GraphicsDeviceType: http://docs.unity3d.com/ScriptReference/Rendering.GraphicsDeviceType.Metal.html
No, unfortunately none of that is helpful.
I'm updating the $$anonymous$$obile$$anonymous$$ovieplayerTexture code so that it will work on IOS. It's no longer supported by the originator of it, and the plugin is not supported by unity 5.2 and above.
Following the plugin samples code here: http://docs.unity3d.com/uploads/Examples/RenderingPluginExample53.zip
I have this working for Pc android and IOS if using opengl, but the sample is missing metal support, specifically the method to get the metal device :
The old plugin API passed the value into the plugin. The newer APi does not. All I need is the method supplied by the unity API to retreive the metal device that unity is using.
There are further samples here: https://bitbucket.org/Unity-Technologies/iosnativecodesamples but these appear not to include the API headers so cannot be compiled !
Your answer
![](https://koobas.hobune.stream/wayback/20220612060156im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to render device camera feed to a texture without using WebCamTexture 0 Answers
EXC_BAD_ACCESS on PreparePresentRenderingSurface (iOS Build) 0 Answers
Force unity to free up some memory 1 Answer
FBO always 0 in native plugin IOS 0 Answers