Unity 支持 DirectX、Metal、OpenGL 和 Vulkan 图形 API,具体取决于 API 在特定平台上的可用性。Unity 使用内置的图形 API 集或在 Editor 中选择的图形 API。
要使用 Unity 的默认图形 API,请执行以下操作:
打开 Player 设置(菜单:__Edit > Project Settings__,然后选择 Player 类别)。
导航到 Other Settings 并确保选中 __Auto Graphics API__:
选中具体平台的 Auto Graphics API 时,播放器构建中包括一组内置图形 API,并在运行时使用适当的图形 API 生成最适合的方案。
未选中具体平台的 Auto Graphics API 时,Editor 使用列表中的第一个 API。因此,例如,要查看应用程序如何在 Editor 中的 OpenGL 上运行,请将 OpenGLCore 移动到列表顶部,Editor 会切换为使用 OpenGL 渲染。
要覆盖默认图形 API 并为 Editor 和播放器使用备用图形 API,请取消选中相关的 __Auto Graphics API__,单击加号 (+) 按钮,然后从下拉菜单中选择图形 API。
Auto Graphics API 列表顶部的图形 API 是默认 API。如果特定平台不支持默认 API,Unity 将使用 Auto Graphics API 列表中的下一个 API。
如需了解平台与着色器语言语义之间的图形渲染行为方式,请参阅平台特定的渲染差异。曲面细分和几何着色器仅受一部分图形 API 的支持。这由着色器编译目标级别控制。
有关特定于图形 API 的信息,请参阅 Metal、DirectX 和 OpenGL 的相关文档。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.