Hello Guest

Author Topic: tk2d Font doesn't work, strange material output?  (Read 6071 times)

stachibana

  • Newbie
  • *
  • Posts: 5
    • View Profile
tk2d Font doesn't work, strange material output?
« on: June 20, 2013, 10:27:21 am »
Hi,

Thank you for great framework :)

I can display text with demo font(/TK2DROOT/tk2ddemo/demobmfont/DemoFont),
but can't with New Font using same test BM Font and png in the same directory.

1) Create TextMesh with Font in the demo directory("DemoFont") displays text with no problem.
2) Create tk2d Font
3) Choose "test" as BMFont, "test_0" as Texture, then commit in the Inspector.
4) Create Text Mesh and choose (3) as Font
5) Display Text in Scene View but nothing when build.
6) Select created Font, and replace material field to material in demo directory("New Material") in the inspector, then commit.
7) It works.

I can't figure out why.
Thank you for your help.



unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2d Font doesn't work, strange material output?
« Reply #1 on: June 20, 2013, 10:59:55 am »
What version of 2D Toolkit are you running, and on what version of Unity?

stachibana

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: tk2d Font doesn't work, strange material output?
« Reply #2 on: June 20, 2013, 01:09:27 pm »
Thank you for your reply.

I'm using 2dToolkit version 2.00 +hotfix2 and Unity version 4.1.3f3.
I installed both of them today.

stachibana

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: tk2d Font doesn't work, strange material output?
« Reply #3 on: June 20, 2013, 01:11:53 pm »
Sorry Unity is version 4.1.5f1.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2d Font doesn't work, strange material output?
« Reply #4 on: June 20, 2013, 04:25:28 pm »
Just tried it in the same version, and I can't reproduce this at all. The font works fine, as long as I create it properly.
Can you send me a zip of the project? Is it small enough? If not, can you please create a repro case of this in an empty project, please?
support at unikronsoftware.com if possible.

stachibana

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: tk2d Font doesn't work, strange material output?
« Reply #5 on: June 20, 2013, 05:48:54 pm »
Hi,

Thank you for your replay.

I attached the zip of the project.

TextMesh named "TextMesh_w/demofont" is TextMesh with DemoFont in the demo directory,
 "TextMesh_w/newfontwithsameres" is with that I created by same resource of demo("SampleFont" in the "Font" directory).

When I run it, only "TextMesh_w/demofont"displays text.

Thanks.
« Last Edit: June 20, 2013, 05:49:46 pm by unikronsoftware »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2d Font doesn't work, strange material output?
« Reply #6 on: June 20, 2013, 06:10:58 pm »
I think know what it is now :)
All 3 objects in there, bg, TextMesh_w/demofont and TextMesh_w/newfontwithsameres are at the same z value. This can lead to unexpected sorting order, i.e. if the background was drawn AFTER one of those, then it will draw over it.

Give the background a larger z value than the texmeshes (eg. 1), and it should draw predictably.

stachibana

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: tk2d Font doesn't work, strange material output?
« Reply #7 on: June 20, 2013, 06:20:30 pm »
Hi,

I set the z value of bg to 0.1, then both of the TextMesh are now visible!

Thank you for quick replay!