iPhone updating 3d text causes slow down

Having some trouble with 3d text on the iPhone. I have a 3d text in the corner of my game that I constantly update to display distance traveled. The problem I found was that after a few minutes I could see my game get slower and slower until it eventually freezes. When I watch the console in xcode I see that it is constantly running Font.cpp every time it updates.

Now if I stop the update of the text and leave it on the screen the game runs 100% fine?

The funny thing is its a gradual slow down. It works fine at the beginning.

Am I missing something? I use plenty of the 3d text in my game for distance lines but the distance counter at the top is the only one being updated constantly. Has anyone else had this problem and any suggestions on a work around to fix the performance.


maybe unity's code has a memory leak problem and maybe i am wrong. send it as a bug with bug reporter and hopefully they'll solve it.

basically everytime you change the text a new mesh should be created so use GUI functions if you can instead. or at first create many 3d text components and put them in an array and set their texts. do all of this in Awake before starting the game. then just attach them one by one to the object that should display the 3d text. it might not be possible for you because the number of texts might be too high and you don't have much memory to cache them all.

so the general advice is to use Unity GUI if you can. don't use layouting for your gui thow because it's too slow. layout them yourself and don't use GUILayout.