- Home /
Question by
Raiio · Jul 23, 2018 at 12:46 PM ·
touchtouch controlstouchphasetouchesheld
Check whether touch is held
I want to execute code when touch isn't held down. More specifically I want to rewrite this:
if (!Input.GetMouseButton(0))
{
//do this
}
I want it to be determined by touch input with possibility of multiple inputs at once ( not just Input.GetTouch(0) )
My approach:
foreach (Touch touch in Input.touches)
{
if (touch.phase != TouchPhase.Stationary && touch.phase != TouchPhase.Moved)
{
//works not as intended
}
}
Comment
just from reading it, ruling out stationary and moved leaves what, nothing?
But that's just a guess. what is the actual result?
Your answer
Follow this Question
Related Questions
Merging touches 0 Answers
How could I implement diagonal movement in this code? 0 Answers
A touch'es state is always Began and the position doesn't change 1 Answer
Touch.Phase Differences ? 2 Answers
How to show and hide an image by swiping 0 Answers