Author Topic: Create an blank sprite to cover a TextMesh ?  (Read 1529 times)

Docteur Cox

  • Guest
Create an blank sprite to cover a TextMesh ?
« on: July 09, 2013, 08:54:43 AM »
Hello there ! :)

I'm working on something that uses UITable and for some reasons (mostly localization-related stuff) I CAN'T use UILabels. Believe me, I'd prefer to use them, that'd make my life a lot easier, but that's just not possible with that product.

So instead, I've got to work with text meshes. My question is : Is it possible to create an empty sprite that would cover my TextMesh so that UITable works with them ?

Thanks in advance for your answers.
« Last Edit: July 09, 2013, 09:35:37 AM by Docteur Cox »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Create an blank sprite to cover a TextMesh ?
« Reply #1 on: July 09, 2013, 10:14:03 PM »
You'd have to write your own code logic that would figure out the text meshes dimensions and resize an invisible sprite somehow.

Docteur Cox

  • Guest
Re: Create an blank sprite to cover a TextMesh ?
« Reply #2 on: July 10, 2013, 03:26:02 AM »
Thanks for your answer. Just another question : how to instantiate that blank sprite on the fly ? Will a UISlicedSprite work even without an atlas ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Create an blank sprite to cover a TextMesh ?
« Reply #3 on: July 10, 2013, 12:48:43 PM »
UISprite sp = NGUITools.AddWidget<UISprite>();

No, it won't work without an atlas. Sprites need an atlas to work with. If you don't have an atlas, use a UITexture instead.

Docteur Cox

  • Guest
Re: Create an blank sprite to cover a TextMesh ?
« Reply #4 on: July 11, 2013, 02:21:58 AM »
Thanks for your answers :)