unity silder 点击小圆点执行命令
EventTrigger trigger = mySlider.gameObject.GetComponent<EventTrigger>(); EventTrigger.Entry entry = new EventTrigger.Entry(); // 鼠标点击事件 entry.eventID = EventTriggerType.EndDrag; entry.callback = new EventTrigger.TriggerEvent(); entry.callback.AddListener(OnClick); trigger.triggers.Add(entry); private void OnClick(BaseEventData pointData) { Debug.Log("Button Clicked. EventTrigger.."); }
posted on 2022-01-18 11:03 zqiang0803 阅读(47) 评论(0) 编辑 收藏 举报