Author Topic: UILabel  (Read 112344 times)

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #60 on: April 06, 2014, 07:34:10 AM »
Note - the color tags work fine with a Dynamic font. Just not with a Bitmap font.

tkshredder

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UILabel
« Reply #61 on: April 07, 2014, 07:39:36 AM »
Question on using UILabel components to mask a UI texture or sprite - is this possible? (Below is a UI mockup)

It would effectively be a "knockout" effect, where numbers / letters from a font could be used to punch through a background texture / sprite, creating a see-through effect.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #62 on: April 08, 2014, 01:29:08 AM »
@stevej: I am not seeing any issues:

1. New Scene.
2. ALT+SHIFT+L
3. Chose "Arimo20" font.
4. Entered "New [99ff00]Label" as text. "New" is white, "Label" is green.

@tkshredder: When using a dynamic font you can specify a custom material. If you specify a shader that does this, then sure.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #63 on: April 08, 2014, 01:33:15 AM »
@stevej: I am not seeing any issues:

1. New Scene.
2. ALT+SHIFT+L
3. Chose "Arimo20" font.
4. Entered "New [99ff00]Label" as text. "New" is white, "Label" is green.

It has me pretty stumped. I'm using GlyphDesigner to create the fonts and then adding them to an atlas using TexturePacker. Is there any chance that somewhere in that pipeline, I'm ending up with an output file (PNG) that has some property NGUI doesn't like? I know - I might be reaching at this point...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #64 on: April 08, 2014, 01:38:48 AM »
Check the shader used by your atlas. It needs to be Unlit/Transparent Colored.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #65 on: April 08, 2014, 05:55:27 AM »
Check the shader used by your atlas. It needs to be Unlit/Transparent Colored.

Bingo! Was Unlit/Transparent. No idea how that happened.

Thanks so much for all the help - awesome support as usual :)

I'm officially problem free!

MyBestAttempt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UILabel
« Reply #66 on: April 24, 2014, 05:31:32 PM »
Hi,

I am having an issue with my game at the minute, I have successfully managed to get my UILabel to follow a game object however when I zoom in on the object it shrinks the text is there anyway I can stop this from happening?

Thanks.

emo44

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UILabel
« Reply #67 on: April 25, 2014, 07:38:47 AM »
Hi,
How to put a TAB with BBcodein a UILabel, i try [TAB]text[/TAB] but do nothing...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #68 on: April 25, 2014, 10:28:44 AM »
@MyBestAttempt: Not sure what you mean by "shrinks the text". If you've simply made it follow the object, then the label will be exactly the same size as all you're doing is changing its position. This doesn't seem like a UILabel-related question.

@emo44: There is no such tag in NGUI. All the supported tags are mentioned in the original post.

MyBestAttempt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UILabel
« Reply #69 on: April 25, 2014, 10:45:55 AM »
Hi, I suppose "shrinks" isn't technically correct, when you create a label it will stay at the same fixed size regardless of the orthographic size of the primary game play camera, I assume this is because it is the NGUI UI camera which controls the rendering of the label, what I am asking is if there is a way to ensure the label will resize based on the main game cameras orthographic size? i.e. if a user performs a pinch and zoom action that the label will still correctly fill out the area I want. I have attached a screenshot showing the label at the same size when the orthographic size zoomed in.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #70 on: April 25, 2014, 10:47:35 AM »
Sure. Make it be drawn by your game camera by making it be a part of the world, not a part of the 2D UI.

Either that or write a script that will scale it based on your zoom level.

MyBestAttempt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UILabel
« Reply #71 on: April 25, 2014, 11:08:14 AM »
How can I make it be a part of the world instead of the 2d UI?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #72 on: April 26, 2014, 02:23:58 PM »
Add a game object to your world, attach UIPanel to it, and you can then add widgets to it like usual.

qq33357486

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UILabel
« Reply #73 on: May 06, 2014, 10:13:17 PM »
How to Set label font.
label.font is null ,so i can't use label.font.dynamicFont = myfont;
label.bitmapFont is null, so i can't use label.bitmapFont.dynamicFont = myfont;

how do i do to change the label font by code.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #74 on: May 06, 2014, 10:19:18 PM »
UILabel.ambigiousFont = yourFont;