Hello!
I’m developing a 2D game for mobile.
I created a Sensitive button touch for the character walk right by using Canvas + Event Trigger (“Pointer Enter” to walk and “Pointer Exit” to stop walking).
When compile and test cell in my script works correctly, but I have a nasty problem.
Pressing the first button the Event Trigger “Pointer Enter” is triggered, but when shooting the finger from the screen the “Pointer Exit” is not triggered and the character keeps walking ![]()
But if I press the button a second time and take the finger from the screen the “Pointer Exit” will be triggered correctly in version 5.2 of Unity worked right when updated to 5.3.1 stopped working, I’m thinking it’s bug.
Follows my movement script.
public class Player: MonoBehaviour
{
public GameObject player;
public Animator animator;
private bool isMove;
void Start ()
{
isMove = false;
}
void Update()
{
if (isMove == true)
{
player.transform.Translate(Vector2.right * 2f * Time.deltaTime);
}
}
public void moveLeft() //Event Trigger (Pointer Enter)
{
isMove = true;
}
public void touchOff() // Event Trigger (Pointer Exit)
{
isMove = false;
}
}
REMARK!
When retreat the finger Pointer Exit is triggered yes, but character keeps going because I do not know.
Thanks.