- Home /
Why is my touch joystick "sticking"?
I'm using the Unity Standard Asset single joystick, and translating the axes to movement (vertical) and rotation (horizontal).
When I test this in the editor everything works perfectly as intended, but when I install the app on my tablet (Galaxy Tab 4) the joystick sometimes sticks in position and becomes unresponsive for a short time.
Based on some testing it seems to be everything in Canvas as other on screen buttons sometimes don't respond to a tap.
Had this issue on windows 8.1. Worked when using the mouse to move the joystick, but touch input would stick often. Bummer that the solution seems to be to recreate the entire project...
Edit: well I just recreated my project with just a player and a plane, but i'm still seeing the same behavior. After playing with the code a bit it seems that the joystick just stops accepting input, but also doesnt register a OnPointerUp event. I'll continue investigating...
Answer by Ibzy · Apr 19, 2015 at 10:26 PM
In case anyone else has a similar issue, I have found an answer.
From scouring the internet for Unity 5 Canvas issues, people suggested the conversion from 4.6 to 5 caused a few glitches. I created a new project, brought across my assets and recreated the scenes - this worked perfectly and all it now working as intended.
Note: bringing your scene will cause the issue to repeat, and copying all assets from the old scene into the new would also repeat the issue - the scenes need to be rebuilt but can use prefabs/scripts/models previously created.
Answer by pocoster · Sep 28, 2015 at 05:43 PM
Realise this is an old question but ran into this earlier today, so for anyone who has this problem and wants a quick fix then i have one. It did seem to be an issue with bringing assets from 4.6 but if like me and its a time costly job to recreate your levels then i used TouchPhase as a simple work around for now, to ensure the joysticks didn't stick after release.
Just add yourself in an update function into the Joystick.
void Update()
{
if (Input.GetTouch (0).phase == TouchPhase.Began)
{
//Started
}
if (Input.GetTouch (0).phase == TouchPhase.Ended)
{
this.GetComponent<RectTransform>().position = m_StartPos;
UpdateVirtualAxes(m_StartPos);
}
}