Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class OnMouse : MonoBehaviour {
  5.  
  6. void Start () {
  7.  
  8. }
  9.  
  10. void Update () {
  11.  
  12. }
  13. //オブジェクト上でクリックした際に呼び出し
  14. void OnMouseDown() {
  15. Debug.Log("OnMouseDown : " + this.name);
  16. }
  17. //オブジェクト上でクリックしたボタンを離した際に呼び出し
  18. void OnMouseUp() {
  19. Debug.Log("OnMouseUp : " + this.name);
  20. }
  21. //オブジェクト上でクリックし、そのままドラッグした際に呼び出し
  22. void OnMouseDrag() {
  23. Debug.Log("OnMouseDrag : " + this.name);
  24. }
  25. //マウスカーソルがオブジェクトに接触した際に呼び出し
  26. void OnMouseEnter() {
  27. Debug.Log("OnMouseEnter : " + this.name);
  28. }
  29. //マウスカーソルがオブジェクトから離れた際に呼び出し
  30. void OnMouseExit() {
  31. Debug.Log("OnMouseExit : " + this.name);
  32. }
  33. //マウスカーソルがオブジェクト上で接触し続けている間呼び出し
  34. void OnMouseOver() {
  35. //Debug.Log("OnMouseOver : " + this.name);
  36. }
  37. //同じオブジェクト上でOnMouseDown、OnMouseUpした際に呼び出し
  38. void OnMouseUpAsButton() {
  39. Debug.Log("OnMouseUpAsButton : " + this.name);
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement