백지부터 시작하는 이세계 코딩 생활

OnPointerDown 본문

백지부터 시작하는 이세계 유니티 생활 since 2020

OnPointerDown

조아덕 2020. 12. 28. 18:00
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

 

Unity - 스크립팅 API: UI.Selectable.OnPointerDown

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. 닫기

docs.unity3d.com

2 bluemeta.tistory.com/24
Touch Event 관련

 

UI 버튼을 계속 클릭/터치하고 있을 때만 특정 기능 수행시키기 [유니티|Unity]

1. 버튼을 계속 누르는 경우는?  게임 디자인을 하다보면 버튼을 계속 누르고 있어야만 하는 경우가 있을 수 있습니다. 언제가 있을까요? 생각나는 것만 적어보았습니다. 드래그를 하는 상황은

bluemeta.tistory.com

 

3 m.blog.naver.com/PostView.nhn?blogId=lty369&logNo=221236841314&proxyReferer=https:%2F%2Fwww.google.com%2F

 

유니티 OnPointerUp, OnPointerDown

버튼 클릭 인식이 아니라 누르고 떼는거 인식 용도로 사용중입니다 OnPointerDownOnPointerUp둘 다

blog.naver.com

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