- Home /
3D Text (TextMesh) not updated/redrawn every frame (android only)
Hi.
When I try to change a TextMesh's text every frame on Android, the text that is displayed on the scene is sometimes not refreshed (redrawn?). Does anyone know why, and know a solution to this?
Conditions:
This doesn't happen on PC. (I did not test on iPhone)
textMesh.text correctly returns the text that should be displayed. (it's just not drawn)
This doesn't happen with GUIText.
Smallest sample project: Uploaded here.
This is just a simple scene with a camera, a 3D Text and a GUIText. When you touch the screen, the text is changed each frame during the next 10 frames.
On Android: the text is correctly displayed for GUI text, but not for 3DText.
On PC: no problem for both.
This is the script used to update both texts:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript
: MonoBehaviour
{
int _currentVal;
int _targetVal;
void Start ()
{
_currentVal = 0;
_targetVal = 0;
}
bool _HasTouched()
{
#if UNITY_EDITOR
return Input.GetMouseButtonDown(0);
#else
if (Input.touchCount == 0)
return false;
TouchPhase phase = Input.GetTouch(0).phase;
return phase == TouchPhase.Began;
#endif
}
// Update is called once per frame
void Update()
{
if (_HasTouched())
_targetVal += 10;
if (_currentVal < _targetVal)
_currentVal++;
TextMesh textMesh = gameObject.GetComponent<TextMesh>();
if (textMesh != null)
textMesh.text = _currentVal.ToString() + "%";
GUIText guiText = gameObject.GetComponent<GUIText>();
if (guiText != null)
guiText.text = _currentVal.ToString() + "%";
}
}
Posted it on Feedback as it seems to be a bug for me
http://feedback.unity3d.com/unity/all-categories/1/hot/active/textmesh-not-updated-bug-or-
Unity Feedback is for feature requests, not bug reports. Use the bug reporter for that.
I didn't know we could report bugs. Thanks for the information Eric5h5.
Your answer
Follow this Question
Related Questions
3D text with box collider Android 1 Answer
2D Game - GUIText doesn't shake with the camera 0 Answers
TextMesh doesn't work on HTC One X 0 Answers
Trigger the dialogue system 1 Answer