Unity 引擎是用原生 C/C++ 在内部构建的,不过它有一个 C# 封装器可用来与之交互。因此,您需要了解一些 C# 脚本的重要概念。用户手册的这一部分包含有关 Unity 如何实现 .NET 和 C# 的信息,以及在编写代码时可能遇到的任何异常。
有关如何开始在 Unity 中编写脚本的信息以及需要了解的基础知识,请参阅有关在 Unity 中开始编写脚本的文档。
本节涵盖以下主题:
页面 | 描述 |
---|---|
Unity 中的 .NET 概述 | Unity 引擎如何使用 .NET 框架,以及如果之前在 Unity 之外使用过 .NET,可能会遇到的任何差异。这部分还包含有关 Unity 如何管理内存以及如何在项目中引用其他配置文件的信息。 |
脚本后端 | Unity 有两个主要的脚本后端:Mono 和 IL2CPP。本节介绍后端之间的差异以及使用它们的方式和时间,以及它们的限制。此外,还会介绍有关托管代码剥离(从构建中删除不使用的代码)的信息。 |
在编辑器中重新加载代码 | 有关域重新加载以及它们如何影响应用程序性能的信息。此外还包含有关在编辑器启动时运行代码的信息,以及如何使用可配置的进入运行模式快速进入和退出运行模式。 |
脚本序列化 | 序列化是将数据结构或对象状态转换为 Unity 可存储并在以后可重构的格式的自动过程。这包含有关如何以有效方式在项目中使用序列化的信息。 |
脚本编译 | Unity 如何以及以什么顺序编译脚本。还包含有关程序集定义及其最佳使用实践的信息。 |
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.