2D Toolkit Forum

2D Toolkit => Support => Topic started by: pandaryll on August 07, 2013, 02:38:11 pm

Title: Updating values of a text mesh
Post by: pandaryll on August 07, 2013, 02:38:11 pm
Hi,

I'm rewriting some of my OnGUI code to something equivalent in 2Dtoolkit.
One of my GUI values requires it to be updated frequently, like a timer or a current value like current speed.

To display this value i'm using a Tk2DTextMesh Script, which has a text value. Here's my code:
      textValue.GetComponent<tk2dTextMesh>().text = curValue.ToString();

note: textValue is a transform w/c has a tk2dTextMesh component

When I play the game the text value in the inspector is updating but the value does not change while playing.

Title: Re: Updating values of a text mesh
Post by: unikronsoftware on August 07, 2013, 03:01:24 pm
You need to call Commit() before changes are committed to the text mesh.
http://unikronsoftware.com/2dtoolkit/doc/2.10/tutorial/scripting_a_text_mesh.html
Title: Re: Updating values of a text mesh
Post by: pandaryll on August 07, 2013, 03:09:07 pm
It worked thanks!