Version: 2022.2
言語: 日本語

説明

OnMouseUpAsButton is only called when the mouse is released over the same Collider as it was pressed.

関連項目: OnMouseUp.

// Loads the level named "SomeLevel" as a response
// to the user clicking on the object

using UnityEngine;

public class ExampleClass : MonoBehaviour { void OnMouseUpAsButton() { Application.LoadLevel("SomeLevel"); } }

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

This function is called on Colliders and 2D Colliders marked as trigger when the following properties are set to true:

- For 3D physics: Physics.queriesHitTriggers

- For 2D physics: Physics2D.queriesHitTriggers

OnMouseUpAsButton can be a co-routine, simply use the yield statement in the function. This event is sent to all scripts attached to the Collider.