2D Toolkit Forum
2D Toolkit => Support => Topic started by: d13f00l on December 06, 2015, 03:23:20 am
-
I have a working font prefab.
I can use the font in the GUI editor. I want to assign the font in code.
GameObject font = Resources.Load ("gui/HardpixelFontdata") as GameObject;
tk2dFontData fontdata = font.GetComponent <tk2dFontData>();
And then on an existing.. tk2dTextMesh object
tk2dTextMesh textmesh = option.GetComponent <tk2dTextMesh>();
textmesh.font = fontdata;
The text is invisible! If I don't set the font in code, it's fine. No errors are outputted to the console.
-
Nevermind. It's doing exactly what I told it to do. Bit of a scaling issue throws it off the screen!
(http://i.imgur.com/ueWXlBS.png)
-
I'm not sure why this isn't working - please post a repro case in the private support forum and I'll take a look at it.
-
It's fine, it's not invisible. It's off-screen, because my scaling isn't right for the font. Disregard!