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

ngb_yalta

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: NGUI: HUD Text
« Reply #180 on: February 10, 2014, 05:14:46 AM »
return null Works the same...
I've tried this way
  1.         public GameObject enemy;
  2.         private bool show;
  3.  
  4.         void Update () {
  5.                 Debug.Log(show);
  6.                 if(show)
  7.                 {
  8.                         enemy.SendMessage("Damage", 15);
  9.                 }
  10.         }
  11.        
  12.         void EventCall()
  13.         {
  14.                 StartCoroutine("Damage");
  15.         }
  16.        
  17.         public IEnumerator Damage()
  18.         {
  19.                 show = true;
  20.                 yield return null;
  21.                 show = false;
  22.         }
  23.  
And again the same bug, what the heck  :'( no way to achieve hud text with animation call?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #181 on: February 10, 2014, 06:15:15 PM »
I'm guessing your HUDText is set to appear with 100% alpha, correct?

You can fix it by changing HUDText's Add() function. Around line 256 you should see:
  1.                 // Create a new entry
  2.                 Entry ne = Create();
  3.                 ne.stay = stayDuration;
  4.                 ne.label.color = c;
  5.                 ne.val = val;
Change it to:
  1.                 // Create a new entry
  2.                 Entry ne = Create();
  3.                 ne.stay = stayDuration;
  4.                 ne.label.color = c;
  5.                 ne.label.alpha = 0f;
  6.                 ne.val = val;
(or just update to the latest version)
« Last Edit: February 10, 2014, 06:23:06 PM by ArenMook »

Eskinto

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: NGUI: HUD Text
« Reply #182 on: February 24, 2014, 11:34:02 AM »
Hello, I have a question about using custom Dynamic font materials with HudText

In the updated UILabel is very easy to use a custom font material, but the option is not available on HudText, is there an easy way to set the material, I wanted to frankenstein the feature myself, but couldn't get it to work  :P

thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #183 on: February 24, 2014, 05:14:51 PM »
Just add a Material field to the HUDText script, and set the label's material after the "//Create a new entry" part.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: NGUI: HUD Text
« Reply #184 on: March 09, 2014, 01:19:22 PM »
How can I use Add with stayDuration as infinite? So as it will not deleted?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #185 on: March 10, 2014, 09:34:54 PM »
You shouldn't even be trying. If you want something to stay permanently, just use a simple UILabel.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: NGUI: HUD Text
« Reply #186 on: March 11, 2014, 05:59:37 AM »
How can I do in order to a UILabel stay always over an object that moves?

EDIT:
I created a Label, and I'm using UIFollow Target in order to it stays attached to object.
Now I don't understand if it is possible to resize label by distance, that's the written stay big if I go away the camera, but I want to resize it automatically
« Last Edit: March 11, 2014, 12:41:57 PM by Lui146 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #187 on: March 11, 2014, 08:36:37 PM »
To resize something based on distance, adjust its transform.localScale like you would with any other object.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: NGUI: HUD Text
« Reply #188 on: March 12, 2014, 06:07:13 AM »
Thank You for your reply. I've resolved to scale automatically.

Now I have another problem, when I rotate the camera the words remains correctly in the same place.
If I move the camera the words change place, if I walk away the label move up and go over the head of the character, if I approach, the label move down untile the foot.
There is this problem only when I set an value Y more than 0 at the label. If I set the Y of the label as 0 I don't have this problem, however I want to find the way to keep the label permanent over the head of the character.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #189 on: March 13, 2014, 12:40:37 AM »
Which Y value? The label should not be following your object exactly as-is. It should instead be following some child object of your target, offset to where you want the label to appear (such as right over the character's head).

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: NGUI: HUD Text
« Reply #190 on: March 13, 2014, 01:44:38 PM »
I do in this way:




what's wrong?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #191 on: March 14, 2014, 12:53:25 PM »
You are following "MyPlayer1459". You should instead add a child object to MyPlayer1459, and move it up to be roughly above the player's head. That should be the object that uIFollowTarget is following.

Don't offset the label itself.

iwishash

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: NGUI: HUD Text
« Reply #192 on: March 19, 2014, 08:37:41 AM »
Hi,
I'm using HudText for showing score on the character's head.
My game has multi line characters which run together.
When collide items, the score shows with HudText.
In the HudText panel, all child has same position(0,0,0) and it follows 3d characters.

It reference target position which is on the characters head.


When 3 characters run, it works well as I expected.


But 4 characters, the left side of HudText's position is lower than others.


5 characters, same thing happens.


Only left side of HudText position is different with others.
When this occurs, the Y position of left side HudText is different with others.


My code is simple like below.
  1. int tempBonusScore = MoreComboScoreMini();
  2.             for (int i = lineNumStart; i < lineNumMax; i++)
  3.             {
  4.                 playerMove.score += tempBonusScore;
  5.                 scoreHud[i].Add("+" + tempBonusScore.ToString(), scoreHudColor, 0f);
  6.             }
  7.  

Any advice?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI: HUD Text
« Reply #193 on: March 20, 2014, 02:44:44 AM »
I see no reason for something like that, assuming you are using the latest version of HUDText and NGUI.

TokyoDan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: NGUI: HUD Text
« Reply #194 on: April 14, 2014, 08:01:17 PM »
Hello Aron,

Would HUD Text be good for this?

 I am making a tutorial. The user can either…

1. Tap an object on the screen and a bubble appears above/below/left of/right of (depends on location) the object containing an explanation of what the object does.

2. Tap prev/next buttons and the bubble with explanation move to the location of the prev/next corresponding object that is to be explained.