Hello Guest

Author Topic: tk2dtextmesh how to setfont which imported into a spritecollection in script  (Read 3159 times)

timchiang

  • Newbie
  • *
  • Posts: 3
    • View Profile
I am trying to change the tk2dtextmesh font from script. But the font I was imported into a spritecollection as descripted here :http://www.unikronsoftware.com/2dtoolkit/docs/latest/tutorial/importing_a_font_into_a_sprite_collection.html

how can I do this ?

I found some script in the forum use code like this can load tk2dfontdata , but not spritecollection.
GameObject fontData = Resources.Load("TrollFontData") as GameObject;
textmesh.font = fontData.GetComponent<tk2dFontData>();

Could you give me some help?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
A font imported into a sprite collection also has a tk2dFontData created. It is created when you first add the font into the sprite collection. If you can't remember where you saved this, you can find this by clicking on the font in the sprite collection - then click on the Font data object to highlight it in the project window.