Hello all, hope you’re having a lovely day.
Question about the old input system which we are still using.
So what I am attempting to do is to create an auto-player for our game. I could go through the game simply activating the onClick
element of buttons, etc. But what I really want is to kick-off input via the InputSystem. This way I can auto-play the game fully as a player would. So if a UI element is blocking whatever I want to touch, I am made aware of it.
Now, I am aware I can utilise the event system to achieve the same thing, mostly. However, we have popups in the game which just require you to tap anywhere on the screen to acknowledge
them so they disappear. During these popups there is no btn to press, so to speak. So the EventSystem is unable to be utilised to circumvent that. There are other examples where Input.GetMouseButtonDown
is utilised as well
With this auto-player I essentially want both it and the game itself to have no knowledge of one another. So ideally I’d prefer I didn’t have to explicitly tell these systems how to advance
.
Thus, what I’m wondering. Is there a way to override UnityEngine.Input.GetMouseButtonDown(0)
and UnityEngine.Input.touches
to return behaviour I want? ie. “Yes, pressed this frame” or “Released this frame”
I can see that both GetMouseButtonDown
and touches are using external calls, so there doesn’t appear to be any location where I can inject overrides.
I did, however, notice that the StandaloneInputModule
supplied with EventSystem
in the hierarchy have virtual calls for touches and PointEventData. But even after replacing the EventSystem with my own version and setting/overriding the following methods. I have not been able to achieve my goal. This would appear to be because the Input.GetMouseButtonDown
has no interaction with these.
GetTouchPointerEventData
GetMousePointerEventData
GetPointerData
ProcessTouchPress
ProcessMousePress
Shorthand:
- I require the ability to override
Input.GetMouseButtonDown
to progress through areas of the game which are seeking that from the player. - If this happens to work with the event system out of the box, great. If not, I can set up the event system to tap on buttons wherever else I need it.
Thanks in advance.