Unity3D脚本手册

翻译:脚本_树

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:

这是一本关于脚本在Untiy中如何工作的简短概述。

脚本在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 forMonoBehaviour.

也可以使用事件处理程序,这些函数的名字都开始于On(类似的OnCollisionEnter),看所有的预定义事件列表,查阅文档 MonoBehaviour .

Subsections 章节

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目录 欢迎使用 Unity................................................................................................................................1 一、用户指南..................................................................................................................................2 1.1. Unity 基础(Unity Basics) .........................................................................................2 1.1.1. 学习界面...........................................................................................................2 1.1.2. 资源工作流(Asset Workflow) ........................................................................17 1.1.3. 创建场景(Creating Scenes) ............................................................................18 1.1.4. 发布(Publishing Builds)..................................................................................19 1.1.5. 教程(Tutorials)................................................................................................22 1.2. 构建场景(Building Scenes) ....................................................................................23 1.2.1. 游戏物体(GameObject)..................................................................................23 1.2.2. 使用组件(Using Components) .......................................................................25 1.2.3. 预设(Prefab)....................................................................................................30 1.2.4. 光照(Lights)....................................................................................................33 1.2.5. 相机(Cameras) ................................................................................................42 1.2.6. 粒子系统(Particle Systems)............................................................................46 1.2.7. 地形引擎指南(Terrain Engine Guide)............................................................59 1.3. 使用资源(Working with Assets).............................................................................62 1.3.1. 导入资源(Importing Assets) ...........................................................................63 1.3.2. 网格(Meshes)..................................................................................................65 1.3.3. 材质和着色器(Material and Shaders) ............................................................69 1.3.4. 2D 纹理(Texture 2D) ......................................................................................72 1.3.5. 电影纹理(Movie Texture)...............................................................................78 1.3.6. 音频文件(Audio Files) ...................................................................................80 1.3.7. 使用脚本(Using Scripts).................................................................................84 1.3.8. 资源服务器指南(Assets Server Guide)..........................................................88 1.3.9. 场景背后(Behind the Scenes).........................................................................94 1.4. 创建游戏(Creating Gameplay) ...............................................................................94 1.4.1. 运行时实例化预设(Instantiating Prefabs at runtime) ....................................95 1.4.2. 输入(Input)....................................................................................................100 1.4.3. 变换(Transforms)..........................................................................................102 1.4.4. 物理(Physics)................................................................................................107 1.4.5. 动画(Animation) ...........................................................................................124 1.4.6. 角色动画(Character Animation)...................................................................126 1.4.7. 声音(Sound)..................................................................................................133 1.4.8. 游戏接口元素...............................................................................................138 1.4.9. 多人网络.......................................................................................................139 二、常见问题(FAQ)....................................................................................................................141 2.1. 游戏编码问题.......................................................................................................141 2.1.1. 如何制作一个简单的第一人称行走...........................................................141
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值