Question by
DaveDukedom · Dec 21, 2016 at 09:25 AM ·
androidunity 5textmesh
Updating Textmesh causes game to stutter on mobile (c#)
I'm busy creating a simple 2D endless runner.
I've added in gold which the player collects. These items are sprites with a 2D box collider.
After commenting and un-commenting code I was able to discover the game stuttered when I updated the TextMesh with the new gold amount after it was collected.
void OnTriggerEnter2D(Collider2D other)
{
switch (other.name)
{
case "Gold":
goldAm++;
goldAm_Txt.text = "" + goldAm;
Destroy(other.gameObject);
break;
}
}
If I remove, goldAm_Txt.text = "" + goldAm, the game does not stutter.
I've searched around and cant find anything written about text mesh's stuttering the game.
Any ideas on what's happening here?
Thanks. :)
Comment