言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

MonoBehaviour.OnMouseOver()

Switch to Manual

Description

OnMouseOverはGUIElementまたはCollider上にマウスがあり続ける限り毎フレーム呼び出し続けます

	// Fades the red component of the material to zero 
	// while the mouse is over the mesh

	function OnMouseOver () {
		renderer.material.color -= Color(0.1, 0, 0) * Time.deltaTime;
	}

この関数はレイヤーが「Ignore Raycast」のゲームオブジェクトでは呼び出されません。 OnMouseOverは関数の中にシンプルなyield文を使用して、コルーチンにすることができます。 このイベントはColliderまたはGUIElementにアタッチされているすべてのスクリプトに送信されます。