How do I make input.touch not work when button is clicked?

I am using Input.Touches to have my character move, however at the same time I am using UIbuttons for things like jumping. But whenever I click on a Button the touch from Input.touhes also registers and moves the character. What can I do to prevent Input.Touches from making the character move (register the touch) whenever I tap on a button ? In other words is there away to make it so that when the UIButtons are clicked no Touch is registered?

I tried setting the Button’s to a z position of -100. I hoped it would put the buttons “on top” of whatever registers Input.touch, but I guess Input.touch doesn’t have a position- it just registers very touch. Any Ideas?

Got a couple. The video is written for mouse, but it’s the same basic ideas.

1 Like

Perfect! Thank You!

ps if anyone else is having trouble, to make this work on a touch screen do the first method the video shows and then add a 0 inside !EventSystem.current.IsPointerOverGameObject () so !EventSystem.current.IsPointerOverGameObject (0)

1 Like