美文网首页
unity中EventTrigger调用

unity中EventTrigger调用

作者: 沉麟 | 来源:发表于2019-06-11 14:31 被阅读0次
    EventTrigger.TriggerEvent triggerEvent = new EventTrigger.TriggerEvent();
            target.GetComponent<EventTrigger>().triggers.Add(new EventTrigger.Entry() {
                eventID = EventTriggerType.Drag,
                callback = triggerEvent,
            });
    
            target.GetComponent<EventTrigger>().triggers.Add(new EventTrigger.Entry()
            {
                eventID = EventTriggerType.PointerClick,
                callback = triggerEvent,
            });
    
            triggerEvent.AddListener(OnEventCallBack);
            //OnClickListener();
      
        public void OnEventCallBack(BaseEventData eventData) {
            OnClickListener();
        }
    

    相关文章

      网友评论

          本文标题:unity中EventTrigger调用

          本文链接:https://www.haomeiwen.com/subject/nqkqfctx.html