Version: 2017.4

説明

OnMouseUp はユーザーがマウスボタンを離したときに呼び出されます

OnMouseUp はマウスを押した時と同じ GUIElementCollider 上にない場合でも呼び出されることに注意してください。 ボタンのような動作は OnMouseUpAsButton を参照してください。

// Register when mouse dragging has ended. OnMouseUp is called
// when the mouse button is released.

using UnityEngine;

public class ExampleClass : MonoBehaviour { void OnMouseUp() { // If your mouse hovers over the GameObject with the script attached, output this message Debug.Log("Drag ended!"); } }

この関数はレイヤーが「 Ignore Raycast 」のゲームオブジェクトでは呼び出されません。

This function is called on Colliders marked as Trigger if and only if Physics.queriesHitTriggers is true.

OnMouseUp can be a co-routine. Simply use the yield statement in the function. This event is sent to all scripts attached to the Collider or GUIElement.

See Also: OnMouseDown, OnMouseDrag.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961