Hello Guest

Author Topic: Aligned Text / Real world coordinate size of a TextMesh?  (Read 7057 times)

ENAY

  • Newbie
  • *
  • Posts: 17
    • View Profile
Aligned Text / Real world coordinate size of a TextMesh?
« on: April 10, 2012, 10:58:23 am »
If there a way of returning how wide in Unity coordinates how big in width or height?

Basically a ".GetWidth()" function.

What I want to do is make centrally aligned text so I move the text along by half of the mesh width.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Aligned Text / Real world coordinate size of a TextMesh?
« Reply #1 on: April 10, 2012, 11:13:41 am »
You can either use the mesh bounds, or make tk2dTextMesh.GetMeshDimensionsForString() public and call that.

In the event that you just want to position this, and its not going to affect how the string is formatted, simply use the mesh bounds. Its much easier to work with. Otherwise, you can simply make that method public and use that to measure a string for you without actually changing the contents.

ENAY

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Aligned Text / Real world coordinate size of a TextMesh?
« Reply #2 on: April 11, 2012, 03:49:25 am »
I was actually looking at bounds, but thought maybe that it was internally calculated within the mesh itself. Cheers for the tips, looks like I have some things I can experiment with.