How to simulate a keypress in an onclick button on mobile(android/ios)???

I want to simulate a keyboard key press(ex: R key/Reload) in a button click event on a mobile device(android/ios)? Any one know how to pull of such things??! thanks in advanced

  • PressEvent

if you want trigger Event by “PRESS” Button ,I suggest replacing Button with EventTrigger
OnClick will invoke only if mouse is Up

just extends EventTrigger and override OnPointerDown

    public override void OnPointerDown(PointerEventData data)
        Debug.Log("OnPointerDown called.");
  • Simulate keyboard event

this page provide answer for Simulate Keyboard on C#
but in my mind ,I’d rather use this

    public override void OnPointerClick(PointerEventData data)

hope it will help you