Hello Guest

Author Topic: Updating values of a text mesh  (Read 3804 times)

pandaryll

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Updating values of a text mesh
« 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.


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Updating values of a text mesh
« Reply #1 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

pandaryll

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Updating values of a text mesh
« Reply #2 on: August 07, 2013, 03:09:07 pm »
It worked thanks!