Android 4.2 strings bugs.

I’m wondering if this is a known bug or if I discovered a hidden awesome feature to make your texts unreadable…

My code is really simple. I have a string and a textmesh.
I increment the text mesh.text with a simple coroutine like this:

public IEnumerator AnimText(TextMesh textmesh, float chartime){

    	string displaytext="";

    	for(int i=0;i<text.Length;i++){

    		string s=text.Substring(i,1);
    		displaytext+=s;
    		textmesh.text = displayText;
        	yield return new WaitForSeconds(chartime);
    	}
}

The fancy thing is the bug only shows up on recent android phones (android 4.2) and not every time ( I have more than 50 scenes with these animated titles and only 2 or 3 are misbehaving this way, and once again not every time and only on android 4.2 ).
I’m searching on different directions now :

  • maybe the string.substring() behave weirdly on new android versions. maybe the string should be encoded to UTF or ASCII or whatever.

  • maybe a serialization problem (strings are serialized in the class on the scene, they are not saved as prefabs or stored in some xml extern file)

  • maybe a coroutine problem?

I’m in a hurry cos i’m releasing this app on unity/flash, android and ios and the client (MINI brand as you can see, my bad :wink: want the project to be released in a couple of days.
I had a lot to do to make all the versions behaving almost the same way and show the same overall quality (sound/graphics/functionalities). This is the only remaining bug on all these platforms and I can’t figure out where the problem comes from and how to fix this.
That’s why I submit the fancy problem to your brilliant minds.

I know there is a jedi knight in here who can find the solution with his only mind’s power :wink:

“Obi Wan Kenobi, you’re my only hope.”

OK, I figured it out.

It was the dynamic font’s texture that didn’t update on some scenes, causing all missing characters to appear… transparent.
I solved it by calling Font.RequestCharactersInTexture().

It works perfectly now.

bye!