FixedUpdate()
置于这个函数中的代码每隔一定间隔执行(固定的帧率).它通常被用来Rigibody中用力的时候.
// Apply a upwards force to the rigid body every frame
function FixedUpdate () {
rigidbody.AddForce (Vector3.up);
}
OnMouseDown()
当鼠标在一个载有GUI元素(GUIElement)或碰撞器(Collider)的游戏对象里按下时执行该函数内的代
码.
// Loads the level named "SomeLevel" as a response
// to the user clicking on the object
function OnMouseDown () {
Application.LoadLevel ("SomeLevel");
}
OnMouseOver()
当鼠标在一个载有GUI元素(GUIElement)或碰撞器(Collider)的游戏对象里的按下动作抬起后执行该
函数内的代码.
// Fades the red component of the material to zero
// while the mouse is over the mesh
function OnMouseOver () {
renderer.material.color.r -= 0.1 * Time.deltaTime;
} 作者: 驰骋的风 时间: 2013-1-30 13:59
目录