Creating Components
创建组件
When you create a script and attach it to a GameObject, the script appears in the GameObject’s Inspector just like a Component. This is because scripts become Components when they are saved - a script is just a specific type of Component. In technical terms, a script compiles as a type of Component, and is treated like any other Component by the Unity engine. So basically, a script is a Component that you are creating yourself. You will define its members to be exposed in the Inspector, and it will execute whatever functionality you’ve written.
当你创建一个脚本并附加到一个游戏对象上,脚本将显示在对象的检视面板上就像一个组件.这是因为当脚本被保存时脚本变成了组件-一个脚本仅是一个特定类型的组件.在专业术语中,一个脚本编译为一个组件类型,并被Unity引擎视为和任何其他组件一样.所以本质上,一个脚本就是一个组件.你可以定义它的成员来在检视面板上暴露,和它将执行些什么功能.
Read more about creating and using scripts the Scripting section of the manual.
阅读更多关于创建和使用脚本,查看手册的”脚本”部分.