- Home /
,How Do get Touch input to work with the Player Input Component
Hello Everyone, I'm trying to get a Tap on touchscreen to Select objects using the new Input System, but I'm having issues. The method I used, was to create an Input Action with a control scheme that requires touchscreen. I created a single action "Select" that binds the Primary touch input. then I created an empty game object and added the player Input component to it. Dragged in the input action and set the the behavior to call a debug.log through Unity Events as illustrated. When I set it up this way and touch the screen I get no feedback in the editor or on my Android Device. I've tried various different set up such as setting the action type to button or listening for a pointer instead of touch with no success. The best I've been able to accomplish is setting the action type to button and binding to primary touch. Which works as intended in the editor but not after being built to the android device.
Do you guys have any suggestions?
Answer by GerryT · Mar 06, 2021 at 08:46 PM
This doesn't directly fix the problem with the new input system. But I ended up getting the desired results with the old Input system by going to Project Settings > Other Settings > Active Input Handling : Both
Then i used this type of logic
if(Input.touchCount > 0)
{
// Do your thing
}
lastly I Downloaded Unity Remote and Plugged in my phone so I could test it at runtime.
hope this helps anyone who's run into the same problem