Version: 2022.3
Introduction to Metal
Debug Metal graphics

Metal requirements and compatibility

This page lists the requirements for using Metal as well as the features that Metal is compatible with.

Platform compatibility

Unity supports Metal for the Unity Player on iOS, tvOS, and macOS. Unity also supports Metal for the Unity Editor on macOS.

Hardware compatibility

Unity supports Metal for all Apple devices that Unity supports.

渲染管线兼容性

功能 内置渲染管线 通用渲染管线 (URP) 高清渲染管线 (HDRP) Custom Scriptable Render Pipeline (SRP)
Metal Yes (macOS only)

Shader compatibility

Shader data types support

Some Metal devices don’t support the 16-bit half data type. On these devices, Unity shaders represent half as a 32-bit float. Similarly, Unity shaders represent the real data type as a half on mobile devices and as a float on desktop platforms. This section of the documentation is relevant if you want to use the half data type and want to deploy your application to a device that doesn’t support half.

Using half in the correct places can speed up operations, save memory, and save battery power on mobile devices. It’s best practice to use half for values that don’t need high precision and use the information in this section of the documentation to make sure your code handles devices that don’t support half.

For more information about shader data types and the precision they support, see Shader data types and precision.

Support implications

16-bit floating point numbers have low precision compared to 32-bit floating point numbers. If you use half and test your application on a device that supports it, you can often see any issues caused by low precision and then fix them. However, if you test your application on a device that doesn’t support half (and substitutes float for half), this can hide precision issues which will appear later when the application runs on a device that supports half.

If you want to deploy your Unity application to devices that don’t support half, make sure that your code works when float is substituted for half. Metal GPUs that support half, also expect buffers, including constant buffers, to contain 16-bit values. GPUs that don’t support half expect these buffers to contain 32-bit values. Your CPU-side code needs to consider this when you write values to buffers.

Introduction to Metal
Debug Metal graphics