백지부터 시작하는 이세계 코딩 생활
OnPointerDown 본문
OnPointerDown
현재의 상태와 Pressed(눌린) 상태의 트랜지션을 평가하는 함수
// Touch Down Event
public void OnPointerDown(PointerEventData eventData)
// Touch Up Event
public void OnPointerUp(PointerEventData eventDate)
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;// Required when using Event data.
// required interface when using the OnPointerDown method.
public class ExampleClass : MonoBehaviour, IPointerDownHandler
{
//Do this when the mouse is clicked over the selectable object this script is attached to.
public void OnPointerDown (PointerEventData eventData)
{
Debug.Log (this.gameObject.name + " Was Clicked.");
}
}
Ref.
1 docs.unity3d.com/kr/530/ScriptReference/UI.Selectable.OnPointerDown.html
2 bluemeta.tistory.com/24
Touch Event 관련
using UnityEngine;
using UnityEngine.EventSystems;
public class Button : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public void OnPointerDown(PointerEventData eventData)
{
Debug.Log("Pointer Down", gameObject);
}
public void OnPointerUp(PointerEventData eventData)
{
Debug.Log("Pointer Up", gameObject);
}
}
'백지부터 시작하는 이세계 유니티 생활 since 2020' 카테고리의 다른 글
Animation State (Any State) (2) | 2020.12.29 |
---|---|
LivingEntity (0) | 2020.12.28 |
Animation Event 추가 (Clip, FBX) (0) | 2020.12.26 |
Collider (0) | 2020.12.25 |
URP, Unity 2020.1.17 (0) | 2020.12.25 |
Comments