Question by
lasco · Apr 19, 2018 at 05:07 PM ·
c#collideronmousedownpointer
replace "OnPress" (button) by "OnMouseDown" (collider)
Hello, I got some piece of code I must say I don't understand very well. This works only on UI buttons but I need to make it work when click on a collider. How can I manage to replace it with something simple like "void OnMouseDown()" ?
[Serializable]
public class ButtonPressEvent : UnityEvent { }
public ButtonPressEvent OnPress = new ButtonPressEvent();
public void OnPointerDown(PointerEventData eventData)
{
OnPress.Invoke();
}
Thanx
Comment