Author Topic: HUD Text text is huge  (Read 5314 times)

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
HUD Text text is huge
« on: July 19, 2013, 05:49:58 PM »
So I finally got HUD Text to actually do something in my project, and for some reason the text is very big.  Is there a way I can scale it down?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HUD Text text is huge
« Reply #1 on: July 19, 2013, 06:21:19 PM »
How big is very big? It uses the font's default size. You have to ensure that you are using it properly within the UI hierarchy -- underneath the UIRoot + UIAnchor(center) and all that.

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: HUD Text text is huge
« Reply #2 on: July 20, 2013, 02:39:34 AM »
Hmmm...then perhaps I don't understand how HUD Text is supposed to work.  The text is ridiculously huge.  Covers most of the screen.

It's not part of my root UI, but on the model itself like the examples you have.  Unless there is something else I need to do.  I watched your tutorial on YouTube and tried to follow your examples, but I'm not sure if I've done it right.  All other UI elements outside of HUD Text look fine.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HUD Text text is huge
« Reply #3 on: July 20, 2013, 03:48:57 AM »
HUDText needs to be in the UI hierarchy. You can't put it on your model. UIFollowTarget script is what's used to have a UI element follow a 3D model.

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: HUD Text text is huge
« Reply #4 on: July 20, 2013, 04:00:04 AM »
HUDText needs to be in the UI hierarchy. You can't put it on your model. UIFollowTarget script is what's used to have a UI element follow a 3D model.

How can I do this?

Make an object and put the HUD Text script on it?  Where does the UIFollowTarget go?  On the model?  The examples don't seem to be setup this way, which is why I'm a bit confused as to how to actually set it properly.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HUD Text text is huge
« Reply #5 on: July 20, 2013, 02:58:24 PM »
UIRoot
- UI Camera
-- Anchor (center)
--- GameObject with UIFollowTarget on it, set to follow your 3D model
---- Label for unit name
---- Slider for unit health, etc
---- GameObject with HUDText on it

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: HUD Text text is huge
« Reply #6 on: July 20, 2013, 05:23:10 PM »
UIRoot
- UI Camera
-- Anchor (center)
--- GameObject with UIFollowTarget on it, set to follow your 3D model
---- Label for unit name
---- Slider for unit health, etc
---- GameObject with HUDText on it

Hmmm...I already have my own UI root for the main game.  Do I need to setup a brand new UI for each object on the screen?  At the moment, I have HUDText on my main UI root.  Which leaves me with no place for UIFollowTarget as it keeps causing an error when I put it anywhere.  I'll admit that I'm completely new to NGUI, so if I'm doing something wrong, then perhaps some guidance is in order.

Oh, I followed your advice and put a HUDText object in my main UI and the size is normal now.  But as I mentioned above, the UIFollowTarget won't work at all.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HUD Text text is huge
« Reply #7 on: July 21, 2013, 04:28:08 AM »
As I've mentioned twice before, HUDText goes underneath your UI hierarchy under UIRoot. There is always only one UI hierarchy. That's why UIRoot is called "UIRoot". UIFollowTarget goes on the game object right above each HUDText. For each HUDText you will have a new parent object with UIFollowTarget on it. Don't forget to set the camera on it.

UIRoot
- UI Camera
-- Anchor (center)
--- GameObject with UIFollowTarget on it, set to follow your 3D model
---- Label for unit name
---- Slider for unit health, etc
---- GameObject with HUDText on it
--- GameObject with UIFollowTarget on it, set to follow your 3D model
---- Label for unit name
---- Slider for unit health, etc
---- GameObject with HUDText on it
--- GameObject with UIFollowTarget on it, set to follow your 3D model
---- Label for unit name
---- Slider for unit health, etc
---- GameObject with HUDText on it

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: HUD Text text is huge
« Reply #8 on: July 23, 2013, 01:12:02 AM »
Thanks for the information.  I finally managed to figure out what you were doing and why what I was doing wasn't working.  Everything seems to work fine now.

Thanks again.