This is a short overview of how scripting inside Unity works. Scripting inside Unity consists of attaching custom script objects called behaviours to game objects. Different functions inside the script objects are called on certain events. The most used ones being the following: 这是一个简短的Unity脚本手册 Unity的脚本功能,是通过将自定义的脚本附加到物体对象构成的,我们称之为行为.脚本中有各种函数被不同的事件所调用.下面几个最常用的: Update: This function is called before rendering a frame. This is where most game behaviour code goes, except physics code. 这个函数在运行一帧之前被调用.这是很多游戏运行行为代码的地方,除了物理代码. FixedUpdate: This function is called once every physics time step. This is the place to do physics-based game behaviour. 这个函数会在每个固定的物理时间片被调用一次.这是放置游戏基本物理行为代码的地方. Code outside any function 函数外部代码 : Code outside functions is run when the object is loaded. This can be used to initialise the state of the script. ??函数外部的代码在物体被加载时运行.这可以用来初始化脚本状态. Note: Sections of this document assume you are using Javascript, but see Writing scripts in C# for information about how to use C# or Boo scripts. 注意:这个文档假设你使用的是Javascript,否则请查看 Writing scripts in C# (用C#编写脚本)来获取如何使用C#或Boo编写脚本. You can also define event handlers. These all have names starting with On, (i.e. OnCollisionEnter). To see the full list of predefined events, see the documentation for MonoBehaviour. 你也可以使用事件处理程序.这些函数的名字都开始于On(类似的OnCollisionEnter).看所有的预定义事件列表,查阅文档 MonoBehaviour .
- 粉丝: 3
- 资源: 14
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助