I am curious why they made UI System complex.
anyway, If you get any event from Event system(on UI), you can choice 2 options.

1. Using EventTrigger 
=> In my thinking, It's so terrible idea.It needs so many manual tasks. So I skip it. 

2. Using EventSystem
=> It's simple. However, I am finding another solution. Because it's not automation by runtime script.

a. add using...
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.EventSystems;


b. inherit from interfaces
public class BehaviorButton : MonoBehaviour, IPointerEnterHandler {

}


c. add Method
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.EventSystems;

public class BehaviorButton : MonoBehaviour, IPointerEnterHandler {
    public void OnPointerEnter(PointerEventData eventData) 
    {
 
    }
}


You can find it on unity's manual. (https://docs.unity3d.com/Manual/SupportedEvents.html)

IPointerEnterHandler - OnPointerEnter - Called when a pointer enters the object
IPointerExitHandler - OnPointerExit - Called when a pointer exits the object

IPointerDownHandler - OnPointerDown - Called when a pointer is pressed on the object
IPointerUpHandler - OnPointerUp - Called when a pointer is released (called on the original the pressed object)

IPointerClickHandler - OnPointerClick - Called when a pointer is pressed and released on the same object

IInitializePotentialDragHandler - OnInitializePotentialDrag - Called when a drag target is found, can be used to initialise values
IBeginDragHandler - OnBeginDrag - Called on the drag object when dragging is about to begin
IDragHandler - OnDrag - Called on the drag object when a drag is happening
IEndDragHandler - OnEndDrag - Called on the drag object when a drag finishes
IDropHandler - OnDrop - Called on the object where a drag finishes

IScrollHandler - OnScroll - Called when a mouse wheel scrolls

IUpdateSelectedHandler - OnUpdateSelected - Called on the selected object each tick

ISelectHandler - OnSelect - Called when the object becomes the selected object
IDeselectHandler - OnDeselect - Called on the selected object becomes deselected

IMoveHandler - OnMove - Called when a move event occurs (left, right, up, down, ect)

ISubmitHandler - OnSubmit - Called when the submit button is pressed
ICancelHandler - OnCancel - Called when the cancel button is pressed

* 영어 울렁증 가지고 계신분들께 죄송 -_-;; 
* 영어 연습겸 블로그에 영어로 작성중입니다.

2017/09/25 08:06 2017/09/25 08:06

트랙백 주소 :: 이 글에는 트랙백을 보낼 수 없습니다