2D Toolkit Forum
2D Toolkit => Support => Topic started by: bluelotus on October 22, 2012, 11:24:13 am
-
Hi guys,
Trying to get an xml based font exported from glyph designer into 2dtoolkit and running as a sprite collection.. .
It is visible but I had to scale it up by a factor of 100 - the dimensions of the text mesh objects match what the letters should look like but the texture is not aligned and it looks like abstract art.
Any ideas where I am going wrong with this?
Thanks,
Blue L.
-
Can you send me the font, please to support@unikronsoftware.com
-
Have done, :)
Cheers,
Blue L.
-
The mystery is solved and it was my settings! :D
Still a noob at this stuff -
It turns out I had selected the original .png file for the texture map - And not the atlas created tex from the sprite atlas obj. Which is why the texture was misaligned.
I must have set this when I could not see the font at all before I scaled it up in size.
Its now working perfectly thanks for your help!
However, I am now having trouble accessing the text mesh -
Ive tried making the text mesh as the child of the OBJ where the code is being run, and also having it separate as its own object -
But I keep getting,
Does not exist in the current context
or
Type `UnityEngine.GameObject' does not contain a definition for `mytextobj' and no extension method ....
I think there is some confusion for me around variables, scope and syntax for getting and setting -
It is also hard to understand the code examples I have found as the term, "textmesh" is used and I am not sure if this is an instance name or a class name, or something else -
Here are the examples I have been experimenting with -
var myTextMesh = (GetComponent(TextMesh) as TextMesh);
myTextMesh.text = "Pls work";
//and from unity script reference -
public class example : MonoBehaviour {
void Example() {
GetComponent<TextMesh>().text = "Hello World";
}
}
Any advice around how to get this up and running would be great -
Thanks,
Chris.
-
OK solved my problem - ;D
Needed to be referencing tk2dTextMesh - and then commit to update.
this.GetComponent<tk2dTextMesh>().text = FramesPerSec.ToString();
this.GetComponent<tk2dTextMesh>().Commit();
So far so good!
BLue L.