在 Unity 中,您通常使用脚本一段代码,允许您创建自己的组件,触发游戏事件,随时间推移修改组件属性,并以任何您喜欢的方式响应用户输入。 更多信息
参见 术语表 来创建功能,但您也可以以插件的形式包含在 Unity 之外创建的代码。 您可以在 Unity 中使用两种不同类型的插件
托管代码可供 Unity 用于编译脚本的标准 .NET 工具访问。 托管插件代码和 Unity 脚本代码之间的唯一区别是,插件是在 Unity 之外编译的,因此 Unity 可能无法访问源代码。 使用原生插件时,Unity 的工具无法像访问托管库一样访问第三方代码库。 例如,如果您忘记将托管插件文件添加到项目中,您将收到标准的编译错误消息。 而如果您忘记将原生插件文件添加到项目中,您将只在尝试运行项目时收到错误报告。
以下页面解释了如何在您的 Unity 项目中创建和使用插件
主题 | 描述 |
---|---|
导入和配置插件 | 导入和配置托管或原生插件。 |
托管插件 | 有关使用托管插件的详细信息。 |
原生插件 | 有关使用原生插件的详细信息。 |
为桌面平台构建插件 | 为 macOS、Windows 和 Linux 部署原生代码库。 |
低级原生插件接口 | 在您的原生插件中实现低级渲染。 |
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.