Author Topic: NGUI: HUD Text  (Read 164008 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #120 on: September 05, 2013, 04:19:27 AM »
Most obvious reason for that is not setting the cameras correctly. UIFollowTarget needs to transform world space coordinates of your target object to view space using the main camera, then to screen space using the UI camera.

darthviper107

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: NGUI: HUD Text
« Reply #121 on: September 05, 2013, 12:55:26 PM »
Ah, I got it. I thought it was supposed to do find the cameras automatically, now it's working

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
Re: NGUI: HUD Text
« Reply #122 on: September 05, 2013, 10:47:56 PM »
Is it possible to have objects that can block the HUDText?

For instance, if I have a character on screen and an enemy health bar, is there a way that the enemy health bar isn't displayed covering the character, but behind him?

Thanks.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #123 on: September 06, 2013, 11:10:11 PM »
You have to do it in 3D. You wouldn't be using HUDText at this point, just a camera-facing object with a UIPanel on it and widgets underneath.

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
Re: NGUI: HUD Text
« Reply #124 on: September 07, 2013, 12:24:47 PM »
thanks for the reply.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: NGUI: HUD Text
« Reply #125 on: September 14, 2013, 06:31:12 PM »
I'm having some problems with HUDText. I've got this bug suddenly in my game where things used to work, and I'm not sure why. Hoping you guys can give me some clues.

So basically, there's a player and there's enemies. Each get their own HUDText object. In the example screens below, the Player has taken damage and should be showing "-6" and "-7". The enemy has taken a head shot and should be showing "Head Shot!". BUT, all of that text appears on the Player object.

I've paused the running game and grabbed these shots, so this is how it looks "in that moment" (ignore the dead enemy at the Player's location - different Id, from a previous fight).

The game screen. The "Head Shot!" text should be on that enemy in the bottom-right corner.

The HUDText managers:

The Enemy. It's "0" object is the "Head Shot!" text, as it should be.

The Player. Its "0" and "1" are the "-6" and "-7" texts, as they should be.

Any thoughts on what could be causing the text to "attach" to the wrong object?

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: NGUI: HUD Text
« Reply #126 on: September 14, 2013, 07:27:52 PM »
Okay. Found the answer, but I don't know the reason.

It turns out it wasn't the enemy in the screenshot that was "active". There's another one just off-screen.

The answer is that if an enemy is off-screen, it's HUDText appears above the player instead. The reason it started happening was that I shortened the FOV on the main camera which started leaving some enemies out of view.

I don't understand WHY it draws it over the player instead, but I can fix it by tweaking the camera FOV again. Kinda weird.

EDIT: And I just realised, it's not drawing it on the Player object. It's moving it to the center of the screen. It just happens that in my game, the Player is always at the center, so it looks like it's "attached" to the Player.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #127 on: September 16, 2013, 12:03:55 AM »
It's best to check to see if the target is on the screen before trying to use HUDText. UIFollowTarget will reposition the object, but only if the object it's tracking is visible. If it's not visible, it will remain in the middle of the screen, which is what you're seeing.

Cizia

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: NGUI: HUD Text
« Reply #128 on: September 23, 2013, 04:29:52 AM »
Hi Aren,

Since the NGUI 3.0 version HUDText is acting strangely, now the HUD is very big and comes to the camera.

I guess you must be very busy these times but could you have a look?

Regards,

Cizia

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #129 on: September 23, 2013, 04:36:44 AM »
Aww nuts, forgot to update it. I'll do that shortly.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #130 on: September 23, 2013, 06:46:04 AM »
Ok, I've updated the package.

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: NGUI: HUD Text
« Reply #131 on: September 24, 2013, 12:07:30 AM »
I just downloaded the update.  However, it's the same version as the previous one.  The Unity Store says I downloaded the new version, but the files included don't match the file list in the Unity Store.

Just giving you a heads up.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #132 on: September 24, 2013, 07:07:29 PM »
Asset Store bugs out like that sometimes. I will re-upload it tonight.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #133 on: September 24, 2013, 07:54:04 PM »
I just checked -- the version on the asset store is 1.7, which is correct. Make sure to update it via the Asset Store before you try to download it.

droweed

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 1
  • Posts: 16
    • View Profile
Re: NGUI: HUD Text
« Reply #134 on: October 03, 2013, 04:35:25 AM »
 :(

I have an issue regarding HUDText, I just updated NGUI to 3.0.1 and hudtext suddenly borked on me.. the issue is that the font is all blown out.. heres a screenshot

Update: I've fiddled on the issue, and my current work around is settings its scale lower than usual, the defaul is 1, and set it to around .1 or so, kinda weird that it appeared normally before the update

« Last Edit: October 03, 2013, 04:40:59 AM by droweed »