can someone shed some light on why when GUItexture is touched the “Player” only moves once per hit versus moving constantly as long as GUItexture is pressed thanks for anyone helps my first game using mobile touchscreen so still wrapping my head around it oh and here the code for Hit-test
if(Input.touches.Length <= 0)
{
//if no touches then will execute this code
}
else //if there is a touch
{
//loop through all the touches on screen
for (int t = 0; t < Input.touchCount; t++)
{
//execute this code for the next touch (i)
if(Input.GetMouseButton(0) this.guiTexture.HitTest(Input.GetTouch(t).position))
{
//if current touch hits our guitexture, run this code
if(Input.GetTouch(t).phase == TouchPhase.Began)
{
}
This is like the last thing stopping my games progress any insight would be great guys thanks i just want to continue movement while holding the GUI button and it seems it on moves once each tap?
LeftyRighty already answered by pointing the TouchPhase.Began is only true when the touch has just began but not while keep touching your GUI Texture.
You either have to look for a proper TouchPhase parameter or trying to solve it on another way like setting a boolean to true when the touch began and having a separate code block for moving your player when the touch-boolean is true.
ok so to make sure im understanding you correctly, this piece of code will run as long as there is a touch so this should work to help my character walk/run correct?