The question is answered, right answer was accepted
I'm making a tile-based click to move game on tablet where the player's parent is always the tile the player is standing on. I want the player's parent to always be blue, so I have this in Update: transform.parent.GetComponent().material.color = Color.blue;
It works as it should on PC, but on tablet it only works if I'm actively clicking somewhere on the screen. I'm using NavMeshAgent and my character moves to it's destination even if I'm not clicking, but the color of the tiles the player walks across doesn't change unless I'm clicking somewhere on the tablet. It's like the game doesn't update unless I'm inputting on the screen?
Does anyone have any idea? Maybe there's a setting for it on the tablet itself? Thanks in advance.
Answer by Tarald
6 days ago
Found the solution (rookie mistake)... Forgot to add: if (Input.touchCount > 0)
So GetTouch(0) would be an empty array and give me a null reference error.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
3 People are following this question.
Multiple Cars not working
Update the Android Gallery after take a screenshot from android device using unity3d
Best way to sync between different mobile devices?
Distribute terrain in zones
Getting android device's IP