常见问题_2

来源:互联网 发布:!号c语言中是什么意思 编辑:程序博客网 时间:2024/06/06 12:25

1、Time.deltaTime--只读,表示完成最后一帧的时间

2、controller.SimpleMove(forward * curSpeed),其中forward是vector3类的变量,而curSpeed是float变量

3、Input.GetAxis("axisName")  Returns the value of the virtual axis identified by axisName返回输入设备在方法参数axisName所指定的轴上的位移量。如果想添加新的虚拟轴,选择菜单Edit->Project Settings->Input menu

4、GUI.Label( new Rect(10, 10, 100, 20),   "Hello World!" );

5、this.GetComponent<T>()方法是指:该脚本所绑定的游戏对象的组件。this.GetComponent<Transform>().position.x.ToString();获取脚本所在对象的transform组件上的position的x值

6、CharacterController 角色控制器主要用于第三人称或第一人称游戏主角控制,并不使用刚体物理效果。属性slope limit 限制碰撞器只能爬小于等于该值的斜坡

7、GUI.Button(   new Rect(float, float, float, float),      "Idle")

8、animation组件用于回放动画,包括animator controller组件等一系列介绍参考unity scripting api。

9、this.animation.CrossFade("idle");在一段时间内通过动画的名字来淡入该动画,并淡出其他动画。

10、Instantiate (original : Object, position : Vector3rotation : Quaternion) ,克隆一个物体,并设置其位置和旋转

11、magnitude返回得到矢量的长度

12、Mathf.Lerp(float from, float to, float t);根据t的大小,在from到to之间生成一个数;例如:当t = 0返回from,当t = 1 返回to。当t = 0.5 返回from和to的平均值

13、Application.LoadLevel (index:int);//通过关卡(场景)的索引来加载新场景。Application.LoadLevel (name:string);通过关卡(场景)的名字来加载新场景。

原创粉丝点击