Hello Guest

Author Topic: Change color a part of tk2dtextmesh ?  (Read 4479 times)

quangtu89

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 18
    • View Profile
Change color a part of tk2dtextmesh ?
« on: December 18, 2014, 11:04:40 am »
Can change color for a part of text of tk2dtextmesh ? Can anyone help you .
Like this : " this is sample "

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Change color a part of tk2dtextmesh ?
« Reply #1 on: December 19, 2014, 10:18:22 pm »
On the text mesh, turn on InlineStyling, click "?" for help on the syntax.
Eg. This is ^cf00fsample

Will highlight the word "sample" in red.

DamDam

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Change color a part of tk2dtextmesh ?
« Reply #2 on: May 19, 2015, 08:40:55 pm »
Hi and sorry for replying to an old topic (maybe you prefer user start a new topic?) but my problem fits totally with this post.

I want to make a text for a dialog and i want the character name appearing in a different color.

I follow what you re saying in this topic but my text stay in white color.

In my code i put this line :
Code: [Select]
window_text.GetComponent<tk2dTextMesh>().text = " ^cf00fsample ";
But that doesn't work for me.

Note that my font is a personnal font i ve created following your tuto on the site. And my textmesh is set as 'formating';

Have you an idea about what i've miss to make it work ?

(thx in advance and sry for my bad english)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Change color a part of tk2dtextmesh ?
« Reply #3 on: May 19, 2015, 11:36:11 pm »
Try entering it in the inspector, and then try it with one of the built in tk2d fonts. This should work (and does work on the latest released version) - must be missing something somewhere.

DamDam

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Change color a part of tk2dtextmesh ?
« Reply #4 on: May 21, 2015, 10:43:53 pm »
Thx for your answer. That didn't work because  i've not created my font in 32 bits. Now with a new created font it works :)