Tasharen Entertainment Forum

Support => Other Packages => Topic started by: ArenMook on July 11, 2012, 01:31:33 PM

Title: NGUI: HUD Text
Post by: ArenMook on July 11, 2012, 01:31:33 PM
What is it?

In the simplest form, it's like Scrolling Combat Text from World of Warcraft. Numbers pop up, fly up. Unlike SCT, the numbers get automatically added up (for up to one second), and positives and negatives get treated differently, so you can basically show DPS and HPS separately without any additional work on your end.

You can also use it to display text -- such as chat messages -- right above your character's heads. You can even tell messages to stay on the screen for X number of seconds before floating up and fading.

You can (of course) modify the curves for how the messages disappear. This very system is used in Windward.

Examples that come with the package

http://www.tasharen.com/hudtext/ex1/
http://www.tasharen.com/hudtext/ex2/

Video Tutorials

http://www.youtube.com/watch?v=diql3UP1KQM
http://www.youtube.com/watch?v=idVr8-jfdAI (adding unit health bars to go with HUDText)

Usage
You can also tweak the splines on the HUDText script, changing the motion of the text as you see fit.

Example Usage
  1. HUDText hudText = GetComponent<HUDText>();
  2.  
  3. // This will show damage of 123 in red
  4. hudText.Add(-123f, Color.red, 0f);
  5.  
  6. // This will show "Hello World!" and make it stay on the screen for 1 second before moving
  7. hudText.Add("Hello World!", Color.white, 1f);
Have questions? Please ask and I'll improve the documentation accordingly.

Screenshot of it used in Windward

(http://www.tasharen.com/hudtext/hudtext.jpg)
Title: Re: HUD Text Readme.txt
Post by: ArenMook on July 12, 2012, 02:26:04 AM
Unity Forums link: http://forum.unity3d.com/threads/143377-NGUI-HUD-Text?p=980621
Title: Re: NGUI: HUD Text
Post by: catacomber on July 12, 2012, 07:20:55 PM
Thank you so much for this! The minute I saw it, I scarfed it up. I'm sure I'll have questions but you've given me and many others great support so far with NGUI. This is just what I needed.  :  ) 

 :-*
Title: Re: NGUI: HUD Text
Post by: catacomber on July 14, 2012, 08:58:14 PM
When I have both NGUI and Hud examples in the same project, I get these compiler errors:

Scripts named 'LookAtTarget.cs' exist in multiple locations (Assets/HUD Text/Examples/Scripts/LookAtTarget.cs). Please rename one of the scripts to a unique name.
Scripts named 'LookAtTarget.cs' exist in multiple locations (Assets/NGUI/Examples/Scripts/Other/LookAtTarget.cs). Please rename one of the scripts to a unique name.

If I rename one of the scripts, I get a new error message:

Assets/NGUI/Examples/Scripts/Other/LookAtTarget.cs(9,14): error CS0101: The namespace `global::' already contains a definition for `LookAtTarget'

What should I do? Thank you in advance. 
Title: Re: NGUI: HUD Text
Post by: ArenMook on July 14, 2012, 10:07:46 PM
Delete LookAtTarget from HUDText (or dont import it). I'll fix it in the next update -- it seems the metadata changed.
Title: Re: NGUI: HUD Text
Post by: catacomber on July 14, 2012, 10:08:55 PM
Thank you!!!!   :)  I deleted it. No more errors. I know what it does and if I need to use it hopefully I can juggle things. It's useful for NPC's.  :  )  Especially if they're walking around!
Title: Re: NGUI: HUD Text
Post by: catacomber on July 14, 2012, 10:22:34 PM
Oops! Just reopened project and two new errors:

Assets/HUD Text/NGUI/Scripts/Editor/UIWidgetInspector.cs(16,19): error CS0433: The imported type `UIWidget' is defined multiple times
Assets/NGUI/Scripts/Editor/BMFontReader.cs(47,34): error CS0433: The imported type `BMFont' is defined multiple times

Not meaning to be difficult, just letting you know.  :  )  Patiently awaiting what to do. I'm really happy to have this.
Title: Re: NGUI: HUD Text
Post by: ArenMook on July 14, 2012, 10:28:16 PM
Post only in one place please. I get email notifications from every single post. No need to double them up.

http://www.tasharen.com/forum/index.php?topic=1013.0
Title: Re: NGUI: HUD Text
Post by: oregon_tony on September 08, 2012, 04:10:24 AM
How to assign HUD Text to javascript object dynamically created in code?
I do this in my project to create a new game object via code in javascript:

var Zombie:GameObject;
Zombie=Instantiate(createThis[rndNr], transform.position, transform.rotation);

I was trying to do this to assign the script to my Zombie GO, but I get a compile error saying the type "HUDText" isn't found:

   var myHUD : HUDText;   //<< compile error
   Zombie.AddComponent("HUDText");
   myHUD = Zombie.GetComponent("HUDText");
   myHUD.Add(-123f, Color.red, 0f);

Thanks,
Tony
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 08, 2012, 03:05:33 PM
HUDText scripts would need to go into the Plugins folder. Roughly the same place as NGUI when used with javascript.
Title: Re: NGUI: HUD Text
Post by: nkls on September 25, 2012, 04:09:26 AM
Hi.
Bought this extension a couple of days ago, and I really like it. It works great, but I have a question.
Im setting my UIroot by script, to make it support different aspect ratios. Im adding my hud-labels with a reference font, but when i add them by code (score.Add(1500f, Color.green, 0.75f) they dont get the correct scale in my scene. If i add a label with the create widget tool those labels are scaled correctly.
How do I solve this problem?
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 25, 2012, 08:43:45 AM
What do you set on the UIRoot by script?
Title: Re: NGUI: HUD Text
Post by: nkls on September 25, 2012, 09:08:46 AM
I have 3 atlases, SD,HD and SHD. I use my SHD when doing the layout, and my pixel size on that one is 0.5.
I set my Manual height on start by script.

I fixed the problem (temporarily?) by edit this line in the HUDtext script:
float size = font.size * Mathf.Clamp01((time - ent.time) * 4f);

If i divide font.size / 2 everything looks good again.. Is this the right way to go?
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 25, 2012, 09:38:42 AM
Multiply it by font.atlas.pixelSize instead.
Title: Re: NGUI: HUD Text
Post by: nkls on September 25, 2012, 10:16:13 AM
Great, thank you.
Title: Re: NGUI: HUD Text
Post by: steddyman on September 28, 2012, 09:31:44 AM
I just bought this component and I am using it with the full version of NGUI (2.2.1).  I am unsure of how to apply this in my context, so would like a bit of help please.

I want to have a score float up above a Star object whenever the user collects them.  The player is moving up the screen rapidly (think doodle jump) and trying to collect stars along the way.  The stars are in the main scene rendered by the main camera.  I have created the following UI hierarchy:

UI Root (2D)
-Camera
--Anchor - Top Left (score labels)
--Anchor - Top Right (high score labels)
--HudText - contains only HudText and UIFollowScripts

In the collision detection script for my player, I am trying to make the HudText appear above the star like this:
  1.         if(collision.gameObject.tag=="Star") {
  2.                 // Get Collect Star script and trigger it
  3.                 var coll : StarCollected = collision.gameObject.GetComponent(StarCollected);
  4.                 // Setup Hudtext for collection
  5.                 follow.target = collision.gameObject.transform;
  6.                 hudText.Add("100", Color.white, 0.5f);
  7.                 // And tell the star to collect itself
  8.                 coll.CollectStar();
  9.         }

But nothing is appearing on screen.  I have set the Font for the text in the HudText component.

Am I missing something?  Is this the best way?  Also a bit concerned about if the users collects 2 stars in a row too quickly, what would then happen.

Thanks
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 28, 2012, 11:42:51 AM
You need multiple HUDTexts for this. Each star would have its own HUDText element. What I do in Windward is have each game object that needs this kind of text instantiate a HUDText prefab object under the HUDRoot and set its follow target to be that object.
Title: Re: NGUI: HUD Text
Post by: steddyman on September 28, 2012, 02:39:13 PM
Thanks, that will work.

However, why is this not working at all?  I get nothing on screen for it.  What am I missing?
Title: Re: NGUI: HUD Text
Post by: steddyman on September 28, 2012, 03:11:32 PM
Never mind, found it.  Needed to be on a UIAnchor.
Title: Re: NGUI: HUD Text
Post by: steddyman on September 28, 2012, 03:48:23 PM
Sorry about this.  Can you post a small sample of the code you have for instantiating the prefab.  I am using the following, however despite the HUDText appearing in the folder and being in the right layer, it doesn't appear.  Even zooming into it in the Editor show it position right but invisible.

  1.         // Create a hud text for the score
  2.         var hudObj : GameObject;
  3.         hudObj = Instantiate(hudTextPrefab, transform.position, Quaternion.identity);
  4.         hudObj.transform.parent = hud.transform;
  5.         //hudObj.transform.localScale = Vector3.one;
  6.         // Get the HudText  and UIFollow components
  7.         var hudText : HUDText = hudObj.GetComponent(HUDText);
  8.         var follow : UIFollowTarget = hudObj.GetComponent(UIFollowTarget);
  9.         // Set the target to the transfor of the star
  10.         follow.target=transform;
  11.         // Now add the score text
  12.         hudText.Add(score.ToString(), Color.white, 0.5f);
  13.  
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 28, 2012, 09:46:01 PM
Use NGUITools.AddChild. It properly parents things for you, resets the position/rotation/scale, and sets the correct game object layer.
Title: Re: NGUI: HUD Text
Post by: steddyman on September 29, 2012, 07:31:49 AM
Thanks.  Using that method now but still no text appears.

If I pause the game, and use the Widget tool to create a label under the Hud object it appears just fine.  However all the HUDText (Clone) prefabs that appear under that display nothing.

I've tried everything.  Pausing the game and moving the transforms of the HUdText or sub text object that gets greated, enabling and disabling components.  Nothing works.  It only works if I setup a quick test scene and don't spawn anything using prefabs.

As I said, even zooming right in on the editor and there is nothing visible. It's like the text is blank.

I notice that if I pause the game immediately after issueing hudText.Add the little label that gets created under the hudtext is disabled.  I've tried enabling this too and still nothing appears.  Completely lost here.

I've attached a screenshot of what it looks like running.  My other GUI elements work and as stated above manually creating a label also works:
 
Title: Re: NGUI: HUD Text
Post by: steddyman on September 29, 2012, 07:51:51 AM
The problem appears to be an issue with the UIFollowTarget script.

If I comment out the line follow.target=transform, then it works but the text just appears in the middle of the screen.

I've check the script picked up the right cameras for MainCamera and GUICamera and it did, so not sure what is going on here.
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 29, 2012, 10:53:50 AM
Where is your HUDText instantiated? Is it under the HUDRoot / UIRoot?
Title: Re: NGUI: HUD Text
Post by: steddyman on September 29, 2012, 03:01:01 PM
You can see it in the screenshot above.  It is under the Hud GameObject which is a UIAnchor, which is under the camera which is under the UIRoot.

Like I say, works if I create a label manually and also works if I don't set the follow but just appears in the middle of the screen.
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 29, 2012, 03:15:52 PM
Odd then, it sounds like it's not finding the correct cameras to transform from 3D to on-screen coordinates. Is your game camera able to see your UI layer?
Title: Re: NGUI: HUD Text
Post by: steddyman on September 29, 2012, 03:30:58 PM
No it can't.  The only camera that can see my GUI layer is the one under the UIRoot.

It isn't finding the wrong cameras.  I've checked that by making the mGameCamera and mUICamera public in the follow script and they are set to the Main Camera and UI Camera as they should be.
Title: Re: NGUI: HUD Text
Post by: steddyman on September 29, 2012, 03:57:02 PM
To simplify this problem, I have manually created the HUDText object under the HUD prior to starting the scene then created a simple script on the same object that just calls Add once and shows it for 10 seconds. 

I have noticed the following behaviour:
1. If I don't set the follow target, the HUDText appears and works as expected on the screen.  The label that is created at runtime by the component has it's active property enabled in the Inspector.
2. If I set the follow target to any object at all, the HUDText does not appear.  The label that is created at runtime by the component has it's active property set to disabled in the Inspector.

I have changed the UIFollowTarget script as follows as a test, and it never displays Not Visible:

  1.                 // If visible, update the position
  2.                 if (isVisible)
  3.                 {
  4.                         transform.position = mUICamera.ViewportToWorldPoint(pos);
  5.                         pos = mTrans.localPosition;
  6.                         pos.x = Mathf.RoundToInt(pos.x);
  7.                         pos.y = Mathf.RoundToInt(pos.y);
  8.                         pos.z = 0f;
  9.                         mTrans.localPosition = pos;
  10.                 } else {
  11.                         Debug.Log("Not visible");
  12.                 }
  13.  

Really scratching my head with this.  There is obviously something wrong with the follow script.
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 29, 2012, 04:08:18 PM
If it wasn't working right then examples wouldn't work either. I just had a look at it, and moving the "Pivot" object moves the HUDText labels exactly as you'd expect it.
Title: Re: NGUI: HUD Text
Post by: steddyman on September 29, 2012, 04:16:13 PM
Found a work around.

I have to set the DisableIfInvisible flag to true.  If I do that, then follow works.  If I don't do that, then it doesn't and the label is always disabled.  Seems the opposite of what it should be doing.
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 29, 2012, 04:17:52 PM
Is your orthographic camera's range set up correctly? Maybe the label is always outside the view frustum, which is why it gets disabled.
Title: Re: NGUI: HUD Text
Post by: steddyman on September 29, 2012, 05:28:04 PM
The Ortho camera for the UI is the one created by the Create a new UI menu option.  It has a near plane of -2 and a far of 2.

As said, all the other items under this camera are appearing correctly and so are HUDText if they don't have a target set.

If I set a target AND set DisableIfInvisible=true then it all works and displays correctly.  If I set DisableIfInvisible=false (default) then the labels created underneath the HUDText are always disabled.
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 29, 2012, 07:54:01 PM
Right, but if you look at the code, nothing changes the enabled state of the labels if "disableIfInvisible" is set to 'false': line 83 of UIFollowTarget.

The only way they would be disabled is if you disabled them yourself somehow -- or had them start as disabled.
Title: Re: NGUI: HUD Text
Post by: Goosery on October 02, 2012, 09:33:44 AM
Hi there,

Awesome package!  However I am using it as a notification system that needs to display multi-line text.  I use it as below:
  1.                
  2. public void displayHudText(string key, string replacementValue, Color color, float time){
  3.         string textValue = MessageUI.getValue(key, replacementValue);
  4.                 HUDText ht = getInstance<HUDText>();
  5.                 ht.Add(textValue, color, time);
  6.                
  7.                 float scale = 447f/(float)Screen.height;
  8.                 float maxWidth = Screen.width*.35f* scale;
  9.                
  10.                 UILabel[] labels = ht.GetComponentsInChildren<UILabel>();
  11.                 UILabel label = labels[ labels.Length-1 ];             
  12.                 label.lineWidth=(int)maxWidth;
  13.                 label.pivot = UIWidget.Pivot.TopLeft;
  14. }
  15.  

Basically I get a HUDText object(or create one if doesn't exist) then I call the Add() method.  After that I do the line wrapping, which works just fine.  Everything works perfectly!

The problem comes in when my displayHudText() method is called again before the previous text has faded.  It only pops the previous message up by 1 line.  So this works fine for single line texts, but when the text is 2 or more lines, the previous text and the new text will overlap, except for the new text's last line, and the old text's first line.  Is there a way to make the previous text pop up more than 1 line, depending on how many lines the texts are?

Thanks!

Nepoez
Title: Re: NGUI: HUD Text
Post by: Goosery on October 02, 2012, 10:02:25 AM
I have currently a work around, which is to use a dummy UILabel object to process the text, then grab the processed text and then split it by the '\n' then loop through each line and pass it to HudText.Add(), then it will work perfectly.  But perhaps there's already a built in way to avoid this that I don't know of?
Title: Re: NGUI: HUD Text
Post by: ArenMook on October 02, 2012, 04:03:24 PM
Try changing line 248 of HUDText from:
  1. offset += Mathf.Round(ent.label.cachedTransform.localScale.y);
To:
  1. offset += Mathf.Round(ent.label.relativeSize.y * ent.label.cachedTransform.localScale.y);
Title: How to stay HUDText and handling layer depth
Post by: kaywoods on November 09, 2012, 10:44:38 PM
Both NGUI and HUDText packages are imported successfully and works well..

And Two Questions.

1. How the hudText display the UILabel permanently ?
When I put the code like-" hudText.Add("Hello World!", Color.white, 1f);-- it disappeared the UIText after the one seconds duration(1f), I think..

But I'd like to display the text persistently before I manually destroy the text.
So, I set the third parameter to the zero, like this- hudText.Add("Hello World!", Color.white, 0f);,
But it didn't work..
How do I to do that???


2. I added  the hudText.Add() to the several enemies,
And all those have UILabel(produced by hudText.Add()), displayed the screen, even though some of the enemies are hidden behind the building...

I think, if the enemy is at the behind of the building, the hudText UILabel also should be placed at the behind of the building so that it doesn't seen to the players.

How can I do this???


Thanks...in advance... 
Title: Re: NGUI: HUD Text
Post by: ArenMook on November 10, 2012, 11:28:41 AM
Don't use HUDText to display permanent things (such as unit's name). Just create a regular UILabel for that and use UIFollowTarget script on it to have it follow your 3D object.

It's up to you to check if you need checks like "is the unit behind a building?" -- generally doing a raycast into the screen to see if it hits your unit or not prior to calling hudText.Add() is the easiest solution.
Title: Re: NGUI: HUD Text
Post by: Crazy Robot Games on November 11, 2012, 04:44:49 PM
Hey,

I have an object that changes rotation from 0 to 180, when it's at 180, the HUD GUI is backwards. What can I do to make it face the correct way towards the camera at all times?

Thanks,

JL
Title: Re: NGUI: HUD Text
Post by: ArenMook on November 12, 2012, 11:16:19 AM
I think you're missing a face camera script on your UI element.
Title: Re: NGUI: HUD Text
Post by: h0p3y on November 24, 2012, 08:08:43 AM
Hi there i'm very new to unity but very familiar with javascript is there a javascript "hello world" tutorial for HUD Text? I have looked around but have not been able to find anything.
Title: Re: NGUI: HUD Text
Post by: ArenMook on November 24, 2012, 08:24:21 AM
I don't know Javascript, but it should be generally the same as C#. You will need to place HUDText into the Plugins folder along with the full version of NGUI set up for Javascript (http://www.tasharen.com/forum/index.php?topic=6.0) in the same fashion. You will then be able to call all of HUDText's functions, such as hudText.Add("your text");
Title: Re: NGUI: HUD Text
Post by: h0p3y on November 24, 2012, 01:26:03 PM
hey thanks i figured it out - i just wasn't sure how to access a c# method from inside the javascript - some research and fussing with compilation order and i got it! thanks!   :)
Title: Re: NGUI: HUD Text
Post by: joduffy on December 06, 2012, 12:36:47 AM
I have NGUI and was about to buy this addon.

I just wanted to know if it would work with IOS and Android
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 06, 2012, 04:47:26 AM
Yup, sure does. It's just an extension to NGUI, and NGUI runs everywhere.
Title: Re: NGUI: HUD Text
Post by: joduffy on December 06, 2012, 10:52:29 PM
Awesome.

I am going to get the extension then.
NGUI  makes things a lot easier then coding the GUI by hand in the default way.

I had a friend tell me they couldnt get a dll file to compile so from their experience the extension doesnt work on mobile platforms.
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 07, 2012, 04:41:34 AM
That's the free version of NGUI. It doesn't work on iOS I believe. Full version of NGUI works fine.

The HUDText kit comes with the distribution version of NGUI (which has the same limitations as Free). It's there as a stand-alone example, but since it's an extension to NGUI, having the full version of NGUI helps.
Title: Re: NGUI: HUD Text
Post by: joduffy on December 08, 2012, 08:33:48 PM
Thanks for you help.
Ill pass that information onto my friend and see if that solves his problem.

:)
Title: Re: NGUI: HUD Text
Post by: ekilog on December 18, 2012, 03:42:56 PM
Delete LookAtTarget from HUDText (or dont import it). I'll fix it in the next update -- it seems the metadata changed.

Hello,

I got NGUI full version and I just purchased HUD Text and cannot get rid of the compilation error. What should I do ?
UNITY 4 PRO + IOS.
error are :

Assets/NGUI/Scripts/UI/UISlicedSprite.cs(140,30): error CS0115: `UISlicedSprite.OnFill(BetterList<UnityEngine.Vector3>, BetterList<UnityEngine.Vector2>, BetterList<UnityEngine.Color32>)' is marked as an override but no suitable method found to override

Assets/NGUI/Scripts/UI/UITexture.cs(124,33): error CS0546: `UITexture.mainTexture.set': cannot override because `UIWidget.mainTexture' does not have an overridable set accessor

Assets/NGUI/Scripts/UI/UITexture.cs(124,33): error CS0506: `UITexture.mainTexture': cannot override inherited member `UIWidget.mainTexture' because it is not marked virtual, abstract or override

Assets/NGUI/Scripts/UI/UITexture.cs(177,30): error CS0505: `UITexture.OnFill(BetterList<UnityEngine.Vector3>, BetterList<UnityEngine.Vector2>, BetterList<UnityEngine.Color32>)': cannot override because `UIWidget.OnFill(BetterList<UnityEngine.Vector3>, BetterList<UnityEngine.Vector2>, BetterList<UnityEngine.Color>)' is not a method

Assets/NGUI/Scripts/UI/UITiledSprite.cs(50,30): error CS0115: `UITiledSprite.OnFill(BetterList<UnityEngine.Vector3>, BetterList<UnityEngine.Vector2>, BetterList<UnityEngine.Color32>)' is marked as an override but no suitable method found to override


thanks.

Hervé
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 18, 2012, 10:51:37 PM
You need to follow the upgrade instructions carefully. Import HUDText, delete the NGUI folder, import the full version of NGUI.
Title: Re: NGUI: HUD Text
Post by: neken on January 13, 2013, 07:37:56 AM
Hi,

I want to display and follow HUDText on my all enemies individually then i need have multiple UIFollowTarget and one HUDText or i need to duplicate like Enemies.Count = HudText+UIFollow ?
Title: Re: NGUI: HUD Text
Post by: ArenMook on January 13, 2013, 11:53:49 AM
Multiple UIFollowTarget+HUDText combinations. Each Unit should create their own.
Title: Re: NGUI: HUD Text
Post by: Straiker on January 22, 2013, 05:24:16 AM
Hi,

When I change the scene, HUDtext not displayed, but if I load the stage at once that has HUDtext all works. What is the Problem?
Title: Re: NGUI: HUD Text
Post by: ArenMook on January 22, 2013, 08:32:31 AM
Look closer at what's different. HUDText works either way -- in Windward I change scenes all the time (going from menu to different levels) and HUDText works just fine. Check the UI hierarchy and but some Debug.Logs to figure out where your HUDText gets instantiated.
Title: Re: NGUI: HUD Text
Post by: sjames on January 24, 2013, 06:02:50 PM
I'm interested in creating an object pool for HUDText prefabs I've Instantiated so that I can reuse them and move existing ones to different points, or create new ones if they're all in use. Is there something something similar to IsAlive ( particle effects ) that can be used to determine if it's still displaying anything, or will I have to write that. Also what is the proper way to add them to a panel? NGUITools.AddChild() takes gameobjects as arguments.
Title: Re: NGUI: HUD Text
Post by: ArenMook on January 24, 2013, 06:23:23 PM
Generally if the UIFollowTarget has a null target, then it's not following anything, and can be safely recycled.
Title: Re: NGUI: HUD Text
Post by: sjames on January 25, 2013, 12:35:37 AM
I don't destroy the GameObjects that would be the targets as they're pooled for reuse, so the target isn't null unless I set it to be.
Title: Re: NGUI: HUD Text
Post by: sjames on January 25, 2013, 11:44:46 PM
Anyone looking to create a pool with them, you can use IsVisible to see if they're done.
Title: Re: NGUI: HUD Text
Post by: stevej on January 30, 2013, 04:38:40 AM
I'm having trouble getting the HUDText to actually appear on/near the GameObject.

Beneath my main UI hierarchy, I've added an empty object called UIHUDTextManagerCollection.

On each of my monsters, I have the following code in their Start() function:

  1. GameObject htManager = Instantiate(hudTextManager, transform.position, Quaternion.identity) as GameObject;
  2. htManager.GetComponent<UIFollowTarget>().target = transform;
  3. htManager.GetComponent<UIFollowTarget>().uiCamera = GameObject.Find("Camera").GetComponent<Camera>();                  
  4. htManager.transform.parent = GameObject.Find("UIHUDTextManagerCollection").transform;
  5. htManager.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
  6. htManager.name = recordableObject.globalId;
  7.  

When I run the game, I can see that the monster has instantiated a hudTextManager, renamed it, placed it under the UIHUDTextManagerCollection object, etc. BUT the actual text is miles away from the monster that owns it.

What am I doing wrong?

(http://www.stevejarman.com/temp/unity_hudtext.png)
Title: Re: NGUI: HUD Text
Post by: stevej on January 30, 2013, 05:12:46 AM
Nevermind - got things sorted switching to:

  1. GameObject htManager = NGUITools.AddChild(GameObject.Find("UIHUDTextManagerCollection"), hudTextManager);
  2. htManager.GetComponent<UIFollowTarget>().target = transform;
  3. htManager.GetComponent<UIFollowTarget>().uiCamera = GameObject.Find("Camera").GetComponent<Camera>();
  4. htManager.name = recordableObject.globalId;
  5.  
Title: Re: NGUI: HUD Text
Post by: sjames on January 31, 2013, 02:55:12 PM
Since the update I'm getting an error "You should never nest widgets! Parent them to a common game object instead. Forcefully changing the parent." It's only parent is the UIPanel. It errors each time I  use .Add(). Any ideas?

*edit* it's setting their parent as the UIPanel of hudtext adding them to the hudtext. ???
*edit2* reloaded ngui/hudtext and it works.  :o
Title: Re: NGUI: HUD Text
Post by: null on January 31, 2013, 05:00:46 PM
I’m not sure if I should be starting another topic ..

I purchased the HUD Text package and things seems to work fairly well but I seem to have a few issues.

First, I created  scene similar to the orc sample to play around with. When I turn off the main cameras look to action and “fly” the main camera around, the HUD text appears ahead of me, directly opposite of where they were hovering before. My second problem is when I create my UI root and HUD Text scripts the same way in another scene, the text appears not on the go but somewhere close to it. And when I fly the main camera around, the text swoops around not seeming to follow anything. I have other NGUI tooltip, orthogonal and other cameras in that scene. Could one of the cameras be tripping me up? My HUD root is on a separate layer than all the others.

Thanks in advance
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 01, 2013, 12:45:29 AM
Sounds like you need to explicitly specify which cameras should be used on the UIFollowTarget object. It tries to find the camera automatically, and you have more than one camera able to see specific layers, so it's not sure which one should be chosen.
Title: Re: NGUI: HUD Text
Post by: null on February 01, 2013, 11:50:00 AM
I fixed my problem of the HUD text acting wonky but there is still the issue of the HUD text appearing when the main camera is rotated 180. Orc example 1 with the Look at script disabled and the main camera rotated. There is even the floating text waaay in the distance. Any thoughts on this one?


Thanks


Title: Re: NGUI: HUD Text
Post by: ArenMook on February 01, 2013, 01:30:59 PM
You need to update to the latest version.
Title: Re: NGUI: HUD Text
Post by: stevej on February 07, 2013, 04:23:29 AM
Is there a simple way to set the depth on the HUDText item? e.g. I'd like to set its follow target to be another NGUI UISprite object, and have the HUDText appear on top of it.

EDIT: Nevermind - figured out how to do it with a second UI camera at a higher depth showing those HUDText items.
Title: Re: NGUI: HUD Text
Post by: thempus on February 10, 2013, 08:12:02 PM
Is there a way to improve the performance of UIFollowTarget when using around 100 objects displaying at the same time on the screen? On my tests, it is slow too run on iOS.
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 10, 2013, 10:45:38 PM
You could write one script to track 100 number of objects instead of having 100 individual scripts. That's assuming the slowdown actually comes from UIFollowTarget. My guess is that it actually comes from having to rebuild the UI every frame as all 100 widgets need to re-write themselves into the draw buffer every frame.

I'd recommend minimizing that, if possible.
Title: Re: NGUI: HUD Text
Post by: thempus on February 10, 2013, 11:13:10 PM
Thanks for your suggestion, I will try to write one script to track all objects instead of 1 script per object, it makes sense and I haven't seen from that angle before.
Title: Re: NGUI: HUD Text
Post by: thempus on February 12, 2013, 01:05:29 AM
Ok, I've found out what was the problem, and it wasn't ngui of course. Somehow I managed to accidentally put a Rigidbody to the UI Root, and that was slowing down everything.

Anyway I'm using your suggestion and it's helping a lot.

Thanks
Title: Re: NGUI: HUD Text
Post by: SirGive on February 14, 2013, 07:01:31 PM
Hey Aren,

I just bought your package today. Its great! Only thing I wanted to make sure you were aware of was that it appears to not fade out the shadow on the text (if enabled), so it fades to black and then disappears. Unless for some reason my Unity downloaded the wrong version, then never mind! I've attached a reference screenie. The alpha on the actual text is 0, but the shadow is still full at 255. Not something I personally have a problem fixing. :)

*Saved as .gif cause it was apparently too big - don't mind the artifact.
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 14, 2013, 09:13:19 PM
Which version of NGUI do you have in there, SirGive? The latest full version should work fine.
Title: Re: NGUI: HUD Text
Post by: SirGive on February 14, 2013, 09:16:44 PM
I've got NGUI 2.3.3 and HUD Text 1.6
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 14, 2013, 09:25:13 PM
You're right, I will push a fix.
Title: Re: NGUI: HUD Text
Post by: SirGive on February 14, 2013, 09:32:07 PM
Awesome! Very much appreciate the support.
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 14, 2013, 09:33:19 PM
2.3.3b has the fix.
Title: Re: NGUI: HUD Text
Post by: Enzign on February 18, 2013, 10:43:47 AM
I'm getting the following error: "Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption."
This happens when i call the HUDText.Add function, and the error comes from this line:

t.parent = parent.transform;

in the function "static public GameObject AddChild (GameObject parent)" in NGUITools.cs.

Here is my code for handling this. (the dmgTextPrefab is a prefab that is added to my script in the editor):

NGUITools.AddChild(GameObject.Find("UI Root (2D)"), dmgTextPrefab);
dmgText = dmgTextPrefab.GetComponent<HUDText>();
dmgText.Add(-dmg, Color.red, 0.5f);

When i Instantiate the prefab (i end up with double prefabs in the scene) and use the instantiated prefab instead it works fine. Any idea what is causing this?


EDIT: Seems like the AddChild function is instantiating the gameobject as well, so no need for me to do it. All good.
Title: Re: NGUI: HUD Text
Post by: Grondhammar on February 18, 2013, 03:45:36 PM
I just got HUDText today after using NGUI for a while -- very helpful, thanks for making both.

I am having a problem, though, getting HUDText to play nicely with dynamically created objects. It works fine when I use it statically with objects created in the Inspector/Design screen, but not when HUDText is being added dynamically. Here's the failing code (C#):

  1. labelBase = new GameObject("labelbase" + name);
  2. labelBase.AddComponent(typeof(HUDText));
  3. HUDText ht = labelBase.GetComponent("HUDText") as HUDText;
  4. ht.Add("Hi There",Color.white,4.0f);
  5.  

When I run this block, Unity reports:

  1. NullReferenceException: Object reference not set to an instance of an object
  2. HUDText.Update () (at Assets/Libraries/HUD Text/Scripts/HUDText.cs:227)

This error comes when it tries executing ht.Add... I don't want to start digging around in that code, so I'm hoping someone here can help? Thanks.
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 18, 2013, 04:42:58 PM
You need to use NGUITools.AddChild to instantiate UI-related components, providing a valid game object as parent. This game object needs to be in the UI hierarchy. You can't just create a random game object in the middle of nowhere and expect it to work properly with the UI.

Look at how I use HUDRoot.
Title: Re: NGUI: HUD Text
Post by: Enzign on February 19, 2013, 02:46:42 AM
Is there a way to easily change the speed at which the text flows upwards and not having the numbers add up so much? One text per number would be preferable in my case i think.
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 19, 2013, 09:08:02 AM
The speed is controllable by one of the curves on HUDText. To make numbers not add up, just add them as a string (yourNumber.ToString()).
Title: Re: NGUI: HUD Text
Post by: Grondhammar on February 19, 2013, 04:20:03 PM
You need to use NGUITools.AddChild to instantiate UI-related components, providing a valid game object as parent. This game object needs to be in the UI hierarchy. You can't just create a random game object in the middle of nowhere and expect it to work properly with the UI.

Look at how I use HUDRoot.

After eleven hours of work on this, I now have text on the screen. It's staying in the middle of the screen, following no object even though UIFollowTarget has been added and target set (and validated that it's set in the HUD code).

Surely I can't be the only one thinking there should be documentation or at least a video tutorial on how to deal with dynamically created objects and NGUI HUDText? Seems like a very obviously missing piece.
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 19, 2013, 07:56:34 PM
This is what your hierarchy should look like:

UIRoot
- UICamera
-- UIAnchor
--- UIPanel (can have HUDRoot on it)
---- UIFollowTarget (with UI and game camera fields set to correct cameras)
----- HUDText
----- UILabel (unit's name)
----- Slider (unit's health)
Title: Re: NGUI: HUD Text
Post by: Enzign on February 22, 2013, 09:46:56 AM
Thanks ArenMook! Wonderful piece of software. Well worth the money. Both NGUI and the HUD Text. I've used EZ Gui a lot before, and he does have great support as well, but the software is so much harder to use than NGUI imho.
Title: Re: NGUI: HUD Text
Post by: voncarp on February 24, 2013, 10:39:25 AM
The following shows cumulative damage similar to the OnClick() version in ExampleTwo of the package.

  1.         void OnClick ()
  2.         {
  3.                 if (mText != null)
  4.                 {
  5.                         if (UICamera.currentTouchID == -1) mText.Add(-10f + Random.value * -10f, Color.red, 0f);
  6.                         else if (UICamera.currentTouchID == -2) mText.Add(10f + Random.value * 10f, Color.green, 0f);
  7.                 }
  8.         }

By modifying the above code to the following it doesn't show cumulative damage, but each damage individually.

  1.         public void DisplayDamage ()
  2.         {
  3.                 if (mText != null)
  4.                 {
  5.                        
  6.                         totalDamage = totalDamage + damageRecieved;
  7.                         mText.Add("-" + totalDamage , Color.red, 0f);
  8.                        
  9.                 }
  10.         }

What would you suggest to get all the damage to add up as in the example?
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 24, 2013, 11:00:35 AM
If you add a string, it won't add up. If you add a float, it will add up. Change it to this:
  1. mText.Add(-totalDamage , Color.red, 0f);
Title: Re: NGUI: HUD Text
Post by: voncarp on February 24, 2013, 11:09:10 AM
That did it.  Thank you.
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 24, 2013, 12:07:15 PM
One of the most common questions I get is how to add more than just text to the HUD UIs created with HUDText.

Well... here's a video!

http://www.youtube.com/watch?v=idVr8-jfdAI
Title: Re: NGUI: HUD Text
Post by: invitado123 on March 01, 2013, 09:11:05 AM
Hello there, first of all kudos on NGUI, it's made my life so much easier

I've been using HUDText to display the score granted to the player whenever they pick up a star, for this I have this code when the player hits the star

  1.         GameObject nGUI = GameObject.Find("GUI");
  2.         GameObject scoreLabel = NGUITools.AddChild(nGUI, scoreLabelPrefab);
  3.         UIFollowTarget follow = scoreLabel.GetComponent<UIFollowTarget>();
  4.         follow.target = transform;
  5.         follow.gameCamera = Camera.main;
  6.         HUDText hudText = scoreLabel.GetComponent<HUDText>();
  7.         hudText.Add(starValue, Color.red, 0.0f);
  8.  

However my text is not showing up, changing the Disable If Invisible flag does nothing.

the GUI object is a UI created using the UI creation tool of nGUI. The scoreLabelPrefab is a gameObject that contains the UIFollowTarget and HUDText scripts.

Can you please help?

Thank you
Title: Re: NGUI: HUD Text
Post by: ArenMook on March 01, 2013, 09:34:18 AM
You never set the uiCamera property of UIFollowTarget, so it may be finding the wrong one. When you select the instantiated object, where does it appear to be?
Title: Re: NGUI: HUD Text
Post by: invitado123 on March 01, 2013, 09:40:39 AM
You never set the uiCamera property of UIFollowTarget, so it may be finding the wrong one. When you select the instantiated object, where does it appear to be?

The UI camera property is set in the prefab itself, when it gets instantiated it is set correctly.

The object is instantiated under the GUI Object which contains the UIRoot script. I've attached a screenshot of the Hierarchy and Inspector

Title: Re: NGUI: HUD Text
Post by: ArenMook on March 01, 2013, 09:48:03 AM
Some issues I see with your setup:
- I don't see a UIRoot or UIAnchor. Your hierarchy seems to not follow NGUI's default UI setup.
- Your instantiated object is not parented to the UI camera.
- I can't see the transform so I don't know what the values there like... however without a UIRoot I imagine they text ends up being huge. Zoom out.
Title: Re: NGUI: HUD Text
Post by: invitado123 on March 01, 2013, 10:04:54 AM
Some issues I see with your setup:
- I don't see a UIRoot or UIAnchor. Your hierarchy seems to not follow NGUI's default UI setup.
- Your instantiated object is not parented to the UI camera.
- I can't see the transform so I don't know what the values there like... however without a UIRoot I imagine they text ends up being huge. Zoom out.

The GUI Object is the UI object created by the UI setup, I just changed it's name but it does contain the UIRoot script

I tried parenting the object to the Camera under the GUI object to no avail, I also tried parenting to the Anchor object below the Camera object, still the same problem, I've attached another screenshot showing the transform values.

I also noticed that the labels created appear to be shown in the Scene view as tiny specks of white. I've attached a second screenshot of this. It may just be an artifact but that speck of white you see next to the selected object is another label the same as the one that is selected. I am unable to zoom to it as it just dissapears from view, it's just like a dot
Title: Re: NGUI: HUD Text
Post by: ArenMook on March 01, 2013, 10:39:10 AM
Tiny speck of white suggests that your label's size is tiny. Your transform's position is strange. -1414? I'm pretty sure that's off-screen. Are you absolutely 100% sure that your UI camera points to the right one? You mentioned it's set in the prefab... but that's impossible as the prefab can't reference objects that are not within this prefab... and your UI camera should not be in that prefab.
Title: Re: NGUI: HUD Text
Post by: invitado123 on March 01, 2013, 11:44:58 AM
To make sure I've added these lines to my code:

  1.                         GameObject nGUI = GameObject.Find("GUI");
  2.                         Transform camera = nGUI.transform.FindChild("Camera");
  3.                         Transform anchor = camera.FindChild("Anchor");
  4.                         GameObject scoreLabel = NGUITools.AddChild(anchor.gameObject, scoreLabelPrefab);
  5.                         UIFollowTarget follow = scoreLabel.GetComponent<UIFollowTarget>();
  6.                         follow.target = transform;
  7.                         follow.gameCamera = Camera.main;
  8.                         follow.uiCamera = camera.gameObject.GetComponent<Camera>();
  9.                         HUDText hudText = scoreLabel.GetComponent<HUDText>();
  10.                         hudText.Add(starValue, Color.red, 0.0f);
  11.  

This makes sure that the correct camera is set, attached is a screenshot of the higlighted gameobject upon selecting the UI Camera on one of the instanced labels.

I agree that speck suggests the label's size is tiny but increasing their scale doesn't appear to have any effect. Also moving the labels to positions 0,0,0 don't show them on screen
Title: Re: NGUI: HUD Text
Post by: aidji on April 06, 2013, 01:46:55 AM
Is there a simple way to use UIlocalise script on the HUD texts clones?
Title: Re: NGUI: HUD Text
Post by: ArenMook on April 06, 2013, 01:04:56 PM
@invitado: Is your anchor center-aligned? Is the GUI object the one with UIRoot? Is your game camera the only one tagged as "MainCamera"? What does your camera tool window look like?

@deldama: UILocalize doesn't work with HUDText. Instead you should Localization.Localize() the text before passing it to HUDText.
Title: Re: NGUI: HUD Text
Post by: wangzy_88 on April 22, 2013, 03:35:47 AM
How to make a health bar follow with prefab objects?Some of the same objects.
Title: Re: NGUI: HUD Text
Post by: aidji on April 28, 2013, 06:19:36 AM
Hi, i have a problem with Hud Text Point (scripts UIPANEL, HUDROOT, HUDTEXTPOINT):

in the inspector i setup the public Target to : A gameobject
when i run the game i change target to B or C gameobject and pop the hud text but it appear only to target A gameobject, i have checked when the game run the target in the inspector is changed, but the HUD text i pop only keep the value i give before running the game. am i missing something?

after some time i found a way i need to use i cant change the target frpm HUDtextpoint because the cloned HUD TEXT will not update the target, am i Right? so i need one HUD TEXT POINT script for each target?
Title: Re: NGUI: HUD Text
Post by: ArenMook on April 28, 2013, 04:14:23 PM
What is HUD Text Point?
Title: Re: NGUI: HUD Text
Post by: aidji on May 01, 2013, 03:03:41 AM
Hi, here is the script

  1. using UnityEngine;
  2. [AddComponentMenu("NGUI/Examples/Collider - Display Text")]
  3. public class HudTextPoint : MonoBehaviour
  4. {
  5.  
  6.         public GameObject prefab;
  7.         public Transform target;
  8.         public string Text;
  9.         public Color TxtColor;
  10.         public float timer;
  11.  
  12.         HUDText mText = null;
  13.  
  14.         void Start ()
  15.         {
  16.        
  17.                 if (HUDRoot.go == null)
  18.                 {
  19.                         GameObject.Destroy(this);
  20.                         return;
  21.                 }
  22.  
  23.                 GameObject child = NGUITools.AddChild(HUDRoot.go, prefab);
  24.                 mText = child.GetComponentInChildren<HUDText>();
  25.  
  26.                 // Make the UI follow the target
  27.                 child.AddComponent<UIFollowTarget>().target = target;
  28.         }
  29.  
  30.        
  31.         public void PopText (){
  32.                
  33.                 mText.Add(Text, TxtColor, timer);
  34.                
  35.         }
  36. }
Title: Re: NGUI: HUD Text
Post by: ArenMook on May 01, 2013, 03:25:37 AM
You'd need one of these on each object that should use HUDText. For example if you have 2 players, each one needs this script to have text appear over their heads.
Title: Re: NGUI: HUD Text
Post by: redhawk on May 15, 2013, 04:27:21 PM
One of the most common questions I get is how to add more than just text to the HUD UIs created with HUDText.

Well... here's a video!

http://www.youtube.com/watch?v=idVr8-jfdAI

Oh please add this video Link to the Unity Store, your Unity Forums Post (at the top in your intro) and on this Forum board at the top in your Intro.  Also please add a description above the Links (like HUDText Tutorial, HUDText Health Bars). I just found this after reading through this entire post when this is all I was looking for :)
Title: Re: NGUI: HUD Text
Post by: Darkness on August 03, 2013, 05:08:04 AM
I'm not sure where to put this, but since this is the HUD Text thread, I figured I'd start here.

I want to be able to adjust the scale curve in code.  How do I go about doing that?  I tried hudText.scaleCurve().AddKey, but that doesn't work.  Is there any way I can adjust this without doing it manually?  I'd be easier to simply do it in code so that all NPCs have the correct crit damage effect.
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 03, 2013, 02:40:15 PM
Remove the () from scaleCurve.
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 03, 2013, 02:41:42 PM
Oh please add this video Link to the Unity Store, your Unity Forums Post (at the top in your intro) and on this Forum board at the top in your Intro.  Also please add a description above the Links (like HUDText Tutorial, HUDText Health Bars). I just found this after reading through this entire post when this is all I was looking for :)
It's actually linked in the original post under "videos" section.
Title: Re: NGUI: HUD Text
Post by: Darkness on August 05, 2013, 05:01:49 AM
Remove the () from scaleCurve.

Damn, simple mistake, but not sure why I didn't realize that.  Thanks for the help.  Got everything looking great.  :)
Title: Re: NGUI: HUD Text
Post by: ds_2051 on August 15, 2013, 02:44:42 AM
Hi

how i can add offset value so that Hudtext appear/follow on the specific point.

Thanks
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 15, 2013, 06:56:35 AM
GameObject (UIFollowTarget)
- Offset GameObject (HUDText)
Title: NGUI HUD - Dynamic Objects on an existing scene
Post by: miacoviello on August 18, 2013, 12:23:54 AM
Hi can you provide some short instructions how to use NGUI HUD in an existing scene with dynamic game objects?

We have a game where we dynamically create game objects, I've followed the tutorials and for some reason I believe the text is appearing but is very skewed.  If you can provide a quick bullet point instructions to get this going properly with NGUI full version and NGUI HUD it would be appreciated.
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 18, 2013, 06:16:54 AM
Pictures would help. "very skewed" doesn't tell me much. As long as UIFollowTarget+HUDText scripts are in your UI hierarchy, it'll work as expected.
Title: Re: NGUI: HUD Text
Post by: miacoviello on August 18, 2013, 07:39:43 AM
Hi,
please see the skewed text image.  This pops up at the side of the screen when text is expected to appear.. it seems to be the text as it is animated when disappearing.  The hierarchy shows the project, there are 32 of these created in code.
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 18, 2013, 07:53:05 AM
Your "HUD" needs to be under a center-based UIAnchor.

Your first picture just shows some blue rect inside a black rect. Not sure what it's supposed to be?
Title: Re: NGUI: HUD Text
Post by: miacoviello on August 18, 2013, 08:04:12 AM
Hi, the blue rectangle is what I'm talking about.  That is what is popping up at the left of the screen when the text should be appearing above the object.  Any ideas would help, I've updated the project to place the HUD under the anchor but still have the same results (new attachment).  Any ideas or a short bullet point of how to lay this out or code steps would be good.
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 18, 2013, 08:26:53 AM
The steps are in the readme:

1. Attach the HUDText script to a game object underneath your UIRoot and set the font it should use.
2. To make it follow an object drawn with another camera, attach UIFollowTarget to the same object and set its target.
3. From code, use HUDText's Add() function to add new floating text entries.

Easiest way to see what's happening is to switch to your Scene View tab. Game window is not very useful.
Title: Re: NGUI: HUD Text
Post by: miacoviello on August 18, 2013, 11:09:51 AM
Good tip with the scene window, it seems it is zoomed in very close.. let me try a few things.  Thanks.
Title: Re: NGUI: HUD Text
Post by: Cizia on August 22, 2013, 03:28:28 AM
Hi,

First I have to say that I'm the owner of NGUI and HUD Test and I love your work, came lately to your stuff but allowing me to understand how usefull is your work.

I would suggest for HUD text a parameter allowing bold or bigger text, for special hit per example.

Only thing I would say I am missing about your stuff :-)

Regards
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 22, 2013, 09:27:12 AM
I would suggest creating a second HUDText for that that's using a bigger / bold font. For regular hits use the original one, and for crits use the bigger one.
Title: Re: NGUI: HUD Text
Post by: Cizia on August 22, 2013, 09:29:08 AM
Aren,

As simple as that, thanks for your answer I will implement it.

Regards,

Cizia
Title: Re: NGUI: HUD Text
Post by: darthviper107 on September 04, 2013, 05:53:20 PM
Hey, I'm trying to use the UIFollowTarget to make a button position itself above an object but it doesn't seem to work

Here's my hierarchy:

Cube
Main Camera
>UI Root(2D)
     >Anchor
          >Panel
               >Button
And then the UIFollowTarget script is applied to that with the cube as the target, but it's not working, the button just disappears. Am I doing something wrong?
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: darthviper107 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
Title: Re: NGUI: HUD Text
Post by: voncarp 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.

(https://dl.dropboxusercontent.com/u/78828827/Screen%20Shot%202013-09-05%20at%2011.41.04%20PM.png)
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: voncarp on September 07, 2013, 12:24:47 PM
thanks for the reply.
Title: Re: NGUI: HUD Text
Post by: stevej 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.
(http://www.stevejarman.com/temp/hudtext1.jpg)

The HUDText managers:

The Enemy. It's "0" object is the "Head Shot!" text, as it should be.
(http://www.stevejarman.com/temp/hudtext2.jpg)

The Player. Its "0" and "1" are the "-6" and "-7" texts, as they should be.
(http://www.stevejarman.com/temp/hudtext3.jpg)

Any thoughts on what could be causing the text to "attach" to the wrong object?
Title: Re: NGUI: HUD Text
Post by: stevej 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.
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: Cizia 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
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 23, 2013, 04:36:44 AM
Aww nuts, forgot to update it. I'll do that shortly.
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 23, 2013, 06:46:04 AM
Ok, I've updated the package.
Title: Re: NGUI: HUD Text
Post by: Darkness 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.
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 24, 2013, 07:07:29 PM
Asset Store bugs out like that sometimes. I will re-upload it tonight.
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: droweed 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

Title: Re: NGUI: HUD Text
Post by: ArenMook on October 03, 2013, 04:48:36 AM
You need to update HUDText as well, not just NGUI.
Title: Re: NGUI: HUD Text
Post by: droweed on October 03, 2013, 04:51:18 AM
I'm using HUDText 1.7 the latest version, I've just re-imported it and it fixed it self, weird, thanks for the fast feedback :)
Title: Re: NGUI: HUD Text
Post by: sberghici on October 08, 2013, 06:07:45 AM
Is it possible to show text in different colours? For instance I need to show message like this:
Player1(in yellow) killed Player2(in red)
To make "2" looks like "1"

(http://w7callerid.com/hud.jpg)
Title: Re: NGUI: HUD Text
Post by: ArenMook on October 08, 2013, 11:17:22 AM
Yup. Just use the standard color encoding like so: "[ff0000]Red[-] and [00ff00]Green[-]".
Title: Re: NGUI: HUD Text
Post by: greenland on October 15, 2013, 05:17:02 PM
:(

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

I have(had) the exact same problem, and applied the same fix. Weird. I updated both but I guess it was using a cached compiled version or something? maybe?.. Also ran into a weird bug where the asset would not offer the option to import, just download over and over, until restarting unity... Who knows. :o
Title: Re: NGUI: HUD Text
Post by: mikez69 on October 17, 2013, 09:23:42 AM
Hi There

This is my first post so be gentle!  I searched the forum but the results came back empty.

I just installed both NGUI and HUD Text and opened the sample scenes and in both cases the text is almost undetectable small.  I am not sure what would cause that but I will attach a screenshot...unfortunately it might be hard to make sense out of that too.

Any insight on this would be greatly appreciated!
Title: Re: NGUI: HUD Text
Post by: ArenMook on October 18, 2013, 01:09:08 PM
Which versions? You need to use the latest version of both. By the looks of it you're using an old version of NGUI and a new version of HUDText.
Title: Re: NGUI: HUD Text
Post by: mikez69 on October 24, 2013, 04:00:45 PM
That is correct I was one version behind.  All upgraded and looking great!
Title: Re: NGUI: HUD Text
Post by: Deepestblue on October 28, 2013, 03:23:03 PM
Hi there,

just wondering: are there any plans to incorporate direct TTF fonts usage in Hud Text as you did in NGUI 3.0?

Thanks.
Title: Re: NGUI: HUD Text
Post by: ArenMook on October 28, 2013, 11:34:05 PM
I will do it at some point, yes. I just released 3.0.3, it will take some time. :)
Title: Re: NGUI: HUD Text
Post by: quentinp on October 31, 2013, 10:16:40 AM
Just noticed this forum for "other", had posted my problem under NGUI forum:

I have a game with MP splitscreen so there are multiple cameras, and the viewports are different.  UIFollowTarget doesn't seem to handle this properly.

In this pic, the green tank's UI is offset from the green tank - the correct camera is set on UIFollow (verified in the inspector).  Works fine with a single camera, full screen setup:

(http://i.imgur.com/ceWtw9Q.jpg)

Title: Re: NGUI: HUD Text
Post by: ArenMook on November 01, 2013, 11:21:15 AM
UIFollowTarget was written with one camera in mind. In your case you have to take the camera's view rect into consideration.
Title: Re: NGUI: HUD Text
Post by: Cizia on November 07, 2013, 09:59:58 AM
Hi there,

just wondering: are there any plans to incorporate direct TTF fonts usage in Hud Text as you did in NGUI 3.0?

Thanks.

+ 1

By the way, a BIG BIG THANKS Aren for your last update on NGUI, all my problems and boring stuff with the fonts are behind me. Now everything looks perfect.

Great work.

Cizia
Title: Re: NGUI: HUD Text
Post by: ArenMook on November 08, 2013, 11:08:57 AM
Ah yes, thanks for reminding me. I'll do it, but likely not until a week from now or so. Next week is Hack Week in Unity here, so I'll be mostly unavailable.
Title: Re: NGUI: HUD Text
Post by: droweed on November 13, 2013, 08:09:13 AM
I'd like to ask the developer if its possible to implement this scenario, where I'd like all of the hudtexts to be left aligned instead of centered.

cause I'd like to implement it like Warcrafts quest log thingie on the left side.
Title: Re: NGUI: HUD Text
Post by: ArenMook on November 13, 2013, 03:11:08 PM
Set the label to shrink to fit or wrap mode, give it a size you want it to be at its maximum, and give it a left pivot (top left, left, or bottom left).
Title: Re: NGUI: HUD Text
Post by: droweed on November 14, 2013, 09:14:37 AM
thanks!! :D
works like a charm
Title: Re: NGUI: HUD Text
Post by: grunchgrunch on November 18, 2013, 11:22:08 AM
Hello !
First of all, thank you for your great plugin !

I'm having an issue, the text is still showing up even when there is an obstacle between the target object (UIFollow) and the camera.

Any advice ?

Thanx in advance !
Title: Re: NGUI: HUD Text
Post by: ArenMook on November 18, 2013, 11:55:23 AM
It doesn't do raycasting. If you want it hidden, I suggest you perform a raycast periodically (toward the camera) and if something is hit, hide the HUD element.
Title: Re: NGUI: HUD Text
Post by: grunchgrunch on November 18, 2013, 03:38:29 PM
Ok, thank you for your quick answer !
Title: Re: NGUI: HUD Text
Post by: jeldrez on November 21, 2013, 12:50:32 PM
Aren, could you create a topic just for when you update HUD Text? So people interest on it can get notified when it's updated.
Please!

Thanks.
Title: Re: NGUI: HUD Text
Post by: jeldrez on December 09, 2013, 10:50:38 AM
When it's going to be the dynamic fonts supported on HUD Text?
Title: Re: NGUI: HUD Text
Post by: triawyn on December 10, 2013, 11:26:53 AM
i just upgraded NGUI to full version 3 (.07 or so) and now my HUD text is HUGE, basically takes up the entire screen when called.  i saw earlier post that this was corrected in 1.7, however i am using 1.8 already and there is no new update on the asset store...
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 11, 2013, 12:20:13 AM
You need to bring in your HUDText prefabs into the scene in order for them to get upgraded. You then need to Apply the changes. It's mentioned in the NGUI upgrade instructions.

P.S. I just updated it with support for recent NGUI features such as gradients and dynamic fonts.
Title: Re: NGUI: HUD Text
Post by: triawyn on December 11, 2013, 08:49:42 AM
what if i am not using prefabs?  i have objects already in the scene that i simply added the UIfollow and Hudtext scripts to.  they aren't prefabs and don't need to be instantiated.  do i need to make them into prefabs and then remove the originals and replace those with the prefabs?
Title: Re: NGUI: HUD Text
Post by: triawyn on December 13, 2013, 08:42:37 AM
i removed all the scaling from the HUDtext transforms, however i still have a couple more problems.  words and phrases are being split into 2 lines and i do not see any way outside of the code itself to increase the line width of the HUDtext.  for example, a word like "massive" becomes "mass" on one line and "ive" on the next.

also the hudtext no longer is scrolling up as it fades out.  i have not changed the curves since upgrading to NGUI 3 so i dont know why that is not occurring.
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 13, 2013, 10:02:20 AM
Without your project to look at, all I can say is check to see how it differs from the example scenes that come with HUDText (example two in particular).

HUDText's labels are also set to "resize freely", meaning they have no width or height, so there is nothing that would cause them to start a new line unless you've changed this behaviour. You can check this by pausing the game and selecting one of HUDText's labels.

Scrolling up also occurs just fine in the 2nd example.
Title: Re: NGUI: HUD Text
Post by: triawyn on December 13, 2013, 08:22:43 PM
Without your project to look at, all I can say is check to see how it differs from the example scenes that come with HUDText (example two in particular).

HUDText's labels are also set to "resize freely", meaning they have no width or height, so there is nothing that would cause them to start a new line unless you've changed this behaviour. You can check this by pausing the game and selecting one of HUDText's labels.

Scrolling up also occurs just fine in the 2nd example.

thank you.  i was able to find the problem with the multi-line issue.  for some reason that line in the code (UILabel.Overflow.ResizeFreely;) had been commented out.
Title: Re: NGUI: HUD Text
Post by: sberghici on December 18, 2013, 10:37:29 PM
Yup. Just use the standard color encoding like so: "[ff0000]Red[-] and [00ff00]Green[-]".

Hi Aren
I've recently upgraded my project from NGUI 2.7 to 3.0.7 and my multicolor text does not work anymore. Please advice.   
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 19, 2013, 12:38:22 PM
Don't use the darker color tinting if you embed colors. Embed the darker color as well.

label.text = "[000000]Black [ff0000]Red";
Title: Re: NGUI: HUD Text
Post by: John.Bergman on December 29, 2013, 07:02:07 AM
It doesn't do raycasting. If you want it hidden, I suggest you perform a raycast periodically (toward the camera) and if something is hit, hide the HUD element.

I'm pretty new with the ray casting concept, any chance you have a short smaller tutorial of how you would accomplish something like this?
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 29, 2013, 06:52:30 PM
Look into the Physics.Raycast in Unity documentation. It has an example on how to use it.
http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html
Title: Re: NGUI: HUD Text
Post by: pjrm1470 on December 31, 2013, 11:02:16 AM
I just bought it, and i'm having trouble trying to import only this package! I'm receiving this erro:
Quote
Error while importing package: Couldn't decompress package
UnityEditor.AssetStoreContext:OpenPackage(String, String)

any idea on how to fix it?
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 31, 2013, 11:42:05 AM
I don't think I've ever seen that error. Looks like something in Unity. I suggest trying to restart it, and making sure that your Unity version is up to date.
Title: Re: NGUI: HUD Text
Post by: pjrm1470 on December 31, 2013, 12:41:00 PM
I don't think I've ever seen that error. Looks like something in Unity. I suggest trying to restart it, and making sure that your Unity version is up to date.
I did.
NGUI: Next-Gen UI kit install just fine. but this package, don't.
I'm thinking on reinstall unity3d.

==edit==
My Bad. after the 5th re-download, it work.
thanks!
Title: Re: NGUI: HUD Text
Post by: John.Bergman on January 09, 2014, 02:18:40 AM
I think I am close.. but.  The text that shows up in the HUD Text is just huge.  I have 1.9 of HudText, and the 3.0.8 (latest download as of today).

I basically have a script that creates the Enemy Hud object from a prefab, and adds it to the Enemy HUD UI Root (Screen shots attached of the prefab contents.  The problem I have is that the text is just too big, and the UIFollow does follow the cube in the scene, but it is sluggish in its following.

The cube's HUD object (also included via a screen shot) basically includes the HUDTextTest.cs script that locates the cameras and connects up to the various objects after creating the prefab and adding it to the node in the UI tree.  They it starts a background coroutine to just pump a text message into the HudText object, and tweaks the value of the vital bar.  (FWIW, I get the cameras this way because when I add the oculus rift to what I am doing, I end up with extra cameras and was having a great deal of difficulty making sure I capture the correct one.  This script has not been optimized to pool the HUD objects and cache the retrieved cameras.

Everything else appears to work, any ideas what's wrong with the text size?
Title: Re: NGUI: HUD Text
Post by: John.Bergman on January 09, 2014, 02:43:07 AM
OK, I hate it when that happens... As it turns out the Enemy HUD UI Root object had a size of 240x240x240; Interesting since it was a created as an empty game object and then dragged onto the UIRoot.

The next question I have is should the Enemy HUD UI Root object be a panel, or should it just be a GameObject, I know the examples showed the you had multiple panels in the scenes, but without the panel it appears to work... what is the benefit of an additional panel?  I do have a Player HUD displayed in the game as well as these dynamic ones.

Thanks for taking a look, if nothing else, maybe someone will find the example and the post helpful.  :)
Title: Re: NGUI: HUD Text
Post by: John.Bergman on January 09, 2014, 03:40:31 AM
Using the code above, I am unable to turn off the display of the vital bar.

I have tried setactive(false) and NGUITools.SetActive(gameobject,false) on the Gameobject "Health Vital Bar".

Even disabling it in the prefab has it displayed when it is instantiated, although oddly enough the label inside where the Percentage would be shown is not affected (ie, it is not shown).

How in the world do you turn this off?  I have had the same problem on several other objects as well where they do not "obey" and cannot be disabled.
Title: Re: NGUI: HUD Text
Post by: ArenMook on January 09, 2014, 07:34:21 PM
You need to use NGUITools.AddChild(parent, prefab) to create children under your UI hierarchy. You can't create objects in the middle of nowhere and then drag them onto the UIRoot because the scale is going to be way off. UIRoot is scaled by 2 / Screen height, which is usually a very small value. Not to mention that when you instantiate a UI element in the middle of nowhere, NGUI creates an extra panel -- which is bad for draw calls, but happens to be the only way to draw the widget(s) that are not under any other panel.
Title: Re: NGUI: HUD Text
Post by: John.Bergman on January 09, 2014, 08:12:35 PM
  "You need to use NGUITools.AddChild(parent, prefab) to create children under your UI hierarchy"

The panel that was large was one I created inside the Unity Editor (not from code) :-).

It looks like the only remaining issue I have is the turning off of the sliders now. 
Title: Re: NGUI: HUD Text
Post by: Alessaint on January 21, 2014, 04:38:10 AM
I was wondering if HUD Text could be used to display text following an object with UIFollowTarget behaving in such way so that the text's position would be clamped within screen space (acting as pointer to see which direction off the screen the object lies). If not, could you please point me in direction where it would be best make the adjustments in the script?
Title: Re: NGUI: HUD Text
Post by: ngb_yalta on February 07, 2014, 03:32:29 AM
Got a strange flick bug, while calling HudText.Add() with Animation Event, some kind of flickering, any ideas?
Here is video:
Youtube link (http://www.youtube.com/watch?v=QlSL33lQtDA)
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 08, 2014, 01:18:40 PM
HUDText is meant to be used from Update() as there is a certain order to how it works. It seems the animation event is not a part of that update. You can achieve what you want by just using a coroutine like so:
  1. StartCoroutine(AddDamage(123f));
And the coroutine would be:
  1. IEnumerator AddDamage (float amount)
  2. {
  3.     yield return new WaitForSeconds(0f);
  4.     enemy.SendMessage("Damage", amount);
  5. }
I'll modify HUDText in the near future to make it possible to call it from outside of Update, but that trick should work for now.
Title: Re: NGUI: HUD Text
Post by: ngb_yalta on February 09, 2014, 05:27:25 AM
I've tried use coroutine, but got the same issue

Caller script:
  1. void EventCall()
  2.         {
  3.                 StartCoroutine("DoDamage");
  4.         }
  5.        
  6.        
  7.         IEnumerator DoDamage()
  8.         {
  9.                 yield return new WaitForSeconds(0f);
  10.                 enemy.SendMessage("Damage", 15);
  11.         }
  12.  

Receiver:
  1. public void Damage (float damage)
  2.         {
  3.                 if(Health > 0)
  4.                 {
  5.                         Health -= damage;
  6.                         ht.Add(damage.ToString(), Color.red, 0);
  7.                 }
  8.         }
  9.  
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 09, 2014, 05:15:59 PM
Hmm... I may have given the wrong function actually. It should be:
  1. yield return null;
...not WaitForSeconds.
Title: Re: NGUI: HUD Text
Post by: ngb_yalta 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?
Title: Re: NGUI: HUD Text
Post by: ArenMook 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)
Title: Re: NGUI: HUD Text
Post by: Eskinto 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!
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: Noi14 on March 09, 2014, 01:19:22 PM
How can I use Add with stayDuration as infinite? So as it will not deleted?
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: Noi14 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
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: Noi14 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.
Title: Re: NGUI: HUD Text
Post by: ArenMook 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).
Title: Re: NGUI: HUD Text
Post by: Noi14 on March 13, 2014, 01:44:38 PM
I do in this way:

(http://imageshack.com/a/img38/6962/p3vl.png)


what's wrong?
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: iwishash 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.
(http://imageshack.com/a/img593/8555/wt0p.png)
It reference target position which is on the characters head.
(http://imageshack.com/a/img22/3518/pzl8.png)

When 3 characters run, it works well as I expected.
(http://imageshack.com/a/img23/4549/ryee.png)

But 4 characters, the left side of HudText's position is lower than others.
(http://imageshack.com/a/img854/4430/6k9d.png)

5 characters, same thing happens.
(http://imageshack.com/a/img35/4117/8fv1.png)

Only left side of HudText position is different with others.
When this occurs, the Y position of left side HudText is different with others.
(http://imageshack.com/a/img21/8452/cis2.png)

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?
Title: Re: NGUI: HUD Text
Post by: ArenMook 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.
Title: Re: NGUI: HUD Text
Post by: TokyoDan 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.
Title: Re: NGUI: HUD Text
Post by: ArenMook on April 15, 2014, 10:34:55 AM
No, I wouldn't use HUDText for that. I would just create an NGUI window that I would instantiate/position/show as needed.
Title: Re: NGUI: HUD Text
Post by: TokyoDan on April 15, 2014, 05:29:35 PM
Thanks Aron.
Title: Re: NGUI: HUD Text
Post by: Anomalous on May 08, 2014, 04:58:23 PM
I'm using a smaller-than-normal game viewport rect, which was causing UIFollowTarget to believe the target was either offscreen or in the wrong position. To make UIFollowTarget work as expected, I altered its Update() to use WorldToScreenPoint() and ScreenToWorldPoint() rather than WorldToViewportPoint() and ViewportToWorldPoint(). This should also work for the previous poster who was using multiple game viewports.

Is there any reason not to do it this way?
Title: Re: NGUI: HUD Text
Post by: ArenMook on May 09, 2014, 06:39:28 AM
The logic at the time is to simply eliminate the need to transform from view space to screen space. It just saved some calculations. Nothing beyond that.
Title: Re: NGUI: HUD Text
Post by: shallowspace on June 05, 2014, 10:58:45 AM
Apologies if this is covered before elsewhere but I have trouble with the text continuing to be displayed even if the item moves off-screen.

(http://shallow-space.com/wp-content/uploads/2014/06/Unity-2014-06-05-16-53-39-06.jpg)

In this image there are ships behind me shooting at each other but the damage is displayed (yellow boxes) even though the ships are no longer visible.

While I have your attention: Very nice work on NGUI and HUDText, NGUI frustrates me sometimes but I really couldn't imagine Unity without it!

Peace,

James
Title: Re: NGUI: HUD Text
Post by: ArenMook on June 06, 2014, 02:46:09 AM
As I recall UIFollowTarget has the "disableIfInvisible" option. You need to have it checked.
Title: Re: NGUI: HUD Text
Post by: shallowspace on June 06, 2014, 05:26:18 AM
Yes that box is checked... (and is by default)
Title: Re: NGUI: HUD Text
Post by: ArenMook on June 06, 2014, 10:09:19 PM
If that's the case then it should get hidden. Check UIFollowTarget's Update() function, line 93. It sets the visibility there, which iterates through all children and enables/disables them as needed. Note that for this to work it implies that it requires children to work with like so:

GameObject (UIFollowTarget)
- Label (UILabel)

If you do it like so, it won't work because this hierarchy has no children:
Label (UIFollowTarget, UILabel)
Title: Re: NGUI: HUD Text
Post by: shallowspace on June 08, 2014, 05:17:28 PM
Ah yes that's it, many thanks.
Title: Re: NGUI: HUD Text
Post by: ArtemKoval on July 04, 2014, 12:19:14 AM
Hi!

I'm trying to instantiate object with HUDText at runtime. I've got 3 problems.

1.
  1.  
  2.  var label1 = (GameObject) Instantiate(UIController.Instance.Label, Vector3.zero, Quaternion.identity);
  3.  label1.transform.localScale = new Vector3(1f, 1f, 1f);
  4.  label1.transform.parent = UIController.Instance.UIRoot.gameObject.transform;
  5.  
  6.  foreach (Transform child in enemy.GetComponentInChildren<Transform>())
  7.  {
  8.        if ("label" == child.tag)
  9.        {
  10.                  label1.GetComponent<UIFollowTarget>().target = child;
  11.         }
  12.   }
  13.  
  14. public class UIController : Singleton<UIController>
  15.     {
  16.         public GameObject Label;
  17.         public GameObject UIRoot;
  18.  
  19.         public static UIController Instance
  20.         {
  21.             get { return ((UIController) mInstance); }
  22.             set { mInstance = value; }
  23.         }
  24.     }
  25.  

Given the code above HUDText object are instantiating  under UIRoot, but they have scale (360, 360, 360). I'm not sure how to fix this correctly in code.

2. After scale of each HUDText object have been changed by hand they seems to follow objects correctly. But there is one label right in the center of the screen, which is not moving and it seems it's not under UIRoot hierarchy. I don't know what is that and how to fix it to disappear.

3. HUDText objects that are following units are jittering. Units are moving in a rows from top to bottom of the screen, with constant speed
  1.  transform.position += direction * deltaTime;
How to avoid such jittering?

Thanks, Artem.
Title: Re: NGUI: HUD Text
Post by: ArenMook on July 04, 2014, 03:17:42 PM
1. Never use Instantiate. Use NGUITools.AddChild. Look inside the function to find out why.

2. This is because you never set the layer. NGUITools.AddChild does this among other things.
Title: Re: NGUI: HUD Text
Post by: ArtemKoval on July 05, 2014, 12:52:48 AM
Thanks, this helped to solve part of the problems with scale.

But there is still one label right in the center of UI camera and that label is not moving. And there is still this problem with jittering.

  1. var label1 = NGUITools.AddChild(UIController.Instance.UIRoot.gameObject, UIController.Instance.Label);
  2.  
  3.                             foreach (Transform child in enemy.GetComponentInChildren<Transform>())
  4.                             {
  5.                                 if ("label" == child.tag)
  6.                                 {
  7.                                     label1.GetComponent<UIFollowTarget>().target = child;
  8.                                 }
  9.                             }
  10.  

It seems that all labels are in the center and following objects at the same time.

Maybe this will clarify things a bit - actually my objects are followed by Label, not HUDText.
Title: Re: NGUI: HUD Text
Post by: ArenMook on July 05, 2014, 11:28:00 PM
There should only be one UIFollowTarget script per instantiated object, and it should ideally be on a simple game object, not a widget:

GameObject (UIFollowTarget, prefab root)
- UILabel (player name)

The layer must be your UI layer, and the main camera must be set to now draw the UI layer, otherwise NGUI won't be able to determine which camera should be used. Same with the UI camera -- it must not see the world. Whenever there is an issue following objects, layers are generally the cause.
Title: Re: NGUI: HUD Text
Post by: ArtemKoval on July 06, 2014, 08:47:33 AM
Hi!

Thanks for you help. Believe it or not - the problem was in the Disable If Visible flag. When it was turned on the problem with labels hoarding in the center of the screen persisted. When I turned it off everything became normal - no labels in the center.

Regards, Artem.
Title: Re: NGUI: HUD Text
Post by: ArenMook on July 07, 2014, 04:20:53 AM
Ah, that's because the "disable if visible" only is able to disable child objects. This is why I was suggesting using this hierarchy:

GameObject (UIFollowTarget)
- Label child
Title: Re: NGUI: HUD Text
Post by: rei on July 27, 2014, 10:48:11 AM
Hello,
I created a system of enemies spawn.
I already have a prefab enemy with his life bar, how can I associate a life bar each instance of enemy.
Do you have a sample script?

sorry for my english, google translation

thank you for your help
Title: Re: NGUI: HUD Text
Post by: ArenMook on July 27, 2014, 11:35:52 PM
Create a custom MonoBehaviour attached to your enemy:
  1. public class YourCustomMonoBehaviour : MonoBehaviour
  2. {
  3.     public HUDText hud;
  4. }
When you instantiate your UI object, assign the "hud" reference:
  1. GameObject go = NGUITools.AddChild(uiRootObject, lifebarPrefab);
  2. go.GetComponent<UIFollowTarget>().target = your3DEnemy;
  3. your3DEnemy.GetComponent<YourCustomMonoBehaviour>().hud = go.GetComponent<HUDText>();
You can now use the HUDText element from your 3D enemy just by doing your3DEnemy.GetComponent<YourCustomMonoBehaviour>().hud.
Title: Re: NGUI: HUD Text
Post by: rei on August 05, 2014, 11:58:01 AM
Thank you for help ArenMook  :)

I still have trouble understanding the operation.
But I advance.
Title: Re: NGUI: HUD Text
Post by: ArtemKoval on August 10, 2014, 11:19:36 AM
Hi!

Do you have any idea why healthbar jumping is happening? Video is here - https://dl.dropboxusercontent.com/u/19764309/Caelum%202014-07-30%2022-19-36-91.avi

Thanks, Artem.
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 10, 2014, 06:28:50 PM
It's not jumping, it's merely snapping to pixels. Your ships don't, but GUI does. If you don't want it to snap, look at the UIFollowTarget script. It does the snapping inside so just change it.
Title: Re: NGUI: HUD Text
Post by: ArtemKoval on August 12, 2014, 10:22:04 AM
Yep, that helped. Thanks. It's still has slight jitter, but I guess it has something to do with really small delta position per frame (somewhat of 0.0001 of unit).
Title: Re: NGUI: HUD Text
Post by: Benzino07 on August 20, 2014, 04:58:53 AM
Hi, first up great work on NGUI and this extension, they are fantastic.

I have 2 questions:

1) Would using HUDText/NGUI be the best approach for displaying text, icons and progress bars above buildings in a game world? An example of this would be Clash of Clans:

(http://supercell-www-content.s3.amazonaws.com/http://supercell-www-content.s3-website-us-east-1.amazonaws.com/201401/cache/images/made/3da7c3a11aa70ede/clan_screenshot_1_600_349_s_c1_center_top_0_0.jpg)

2) Is there any way to get UILabels/UISprites to scale if the main camera (not the UICamera) is zoomed in or out (by adjusting orthographic size)? Currently they maintain the same size regardless of zoom level and you can see their position change as you zoom in. The sprites and labels is are up to follow a gameObject in the game world using UIFollowTarget.

Thanks.
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 20, 2014, 06:06:39 PM
1. If you want a 2D UI overlay on top of a 3D or isometric game world, then yes.

2. If you want them to scale with the camera zoom level, then I wouldn't use a UIFollowTarget in this case. I'd make my HUDText / HUD elements be children of the 3D game object. This way they would naturally get bigger as you zoom closer, as they would be in your world rather in your UI.
Title: Re: NGUI: HUD Text
Post by: PatrickHC on August 21, 2014, 09:53:59 AM
HI Team,
I am trying to following the tutorial https://www.youtube.com/watch?v=diql3UP1KQM
But any chances to lemme know methods to modify the generated number (font size/ position / content)
Many thx!

Patrick
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 22, 2014, 04:48:18 AM
To modify those properties, select the game object that has the HUDText script attached and modify them in inspector.
Title: Re: NGUI: HUD Text
Post by: sgolby on November 21, 2014, 11:19:15 AM
When using an Outline effect on a font I am finding the HUD Text "fades to black" rather than fades transparent.
Turning off the Outline Effect fixes it as can be seen in the screenshot.
Is this a known issue ?

The bad news is my HUD Text is probably quite old, the file date is 10/28/2013 (I can't seem to find a version in the files) the reason being I'm stuck on NGUI Pro v2.7.0 until I have time to do a major upgrade. (game was supposed to be released late 2013 right when 3.0 beta came out, so I decided not to change just before release, and the release got majorly delayed)

So... if "Just Upgrade" is the answer, will the current version of HUD Text on the Asset Store download work with NGUI v2.7.0 ?   or can I get the last version of HUD Text that matches NGUI Pro v2.7.0 somehow ?

(http://www.appbite.com/apps/bingo/images/HUD-Text-fade-to-black-with-outline.png)
Title: Re: NGUI: HUD Text
Post by: ArenMook on November 21, 2014, 09:19:07 PM
This is due to how outline is done. TO draw an outline, text is drawn multiple times. First in black, then in your proper color (in your case -- pink). When you fade a label, it does the same thing, just with a semi-transparent alpha. In your alpha = 1.0 case, you only see black on the edges. Pink colors the center fully. However when you fade something, the blackness can be seen through it.

There is no way around it other than creating this font effect in photoshop instead of using the inspector-chosen effect.
Title: Re: NGUI: HUD Text
Post by: sgolby on December 03, 2014, 11:17:51 AM
Thanks for the explanation, I used the Curve stuff to more quickly adjust the Alpha channel towards the tail end so it fades very fast now in the last 0.5s but stays at 100% for most of the float up, a lot less noticeable.
Title: Re: NGUI: HUD Text
Post by: SkaiCloud on December 17, 2014, 01:32:16 AM
ArenMook,

I know HudText hasn't been updated for awhile but I still like it. I'm trying to add random value to the offset curve but it requires me to edit the code but I'm not as good as you cause I tried to add some curve and it either gives me errors or does things that I expected to do but didn't do. In future updates (which I hope soon) can you add random side curve and random offset curve? It would be nice to allow us to adjust which way the text will fly, bounce, zoom out etc. Thanks!
Title: Re: NGUI: HUD Text
Post by: ArenMook on December 17, 2014, 03:56:15 PM
Why do that? Assuming you are trying to do something like add hud text above the character's head, you should be making UIFollowTarget follow a game object that's above the player's head, not the player itself. I'm not suite sure what you mean by "random offset curve". What are you trying to randomize?
Title: Re: NGUI: HUD Text
Post by: SkaiCloud on December 17, 2014, 07:15:30 PM
I made a damage text for a TD game. Each turret has its own hudtext so if they are attacking a target the hudtext will increment it's own damage. Each turret can also cause ability effect which will change the color of the text. Well imagine you have 6 of that turret shooting at one enemy. You will have texting bunched up in one area scrolling upward. A better approach to this is to randomize the text scroll either bounce left or bounce right so you can better see the damage.

It's important for player to see this damage so they can better understand what tower and what element is causing the most damage so player can upgrade their weakest element.
Title: Re: NGUI: HUD Text
Post by: vivalavida on August 05, 2015, 06:06:56 AM
Hi Aren,
1) What I'm trying to achieve is when an enemy receives multiple damages I want to reset all the animation curves but with the new value.(ie on first damage +1, on second damage within the duration limit it should show +2, but with position/alpha/scale curves reset). How should I go about doing this?
2)Also, is there a way to make the text curve towards the left/right while floating up?

Thanks.
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 05, 2015, 07:22:25 AM
1. Modify HUDText's Add() function to reset the "stay" duration like it does on line 274. You will want the same setter to be right after line 259 and 265.

2. Yes, but to get that you will want to change the 1-dimensional "offsetCurve" to be something 2-dimensional instead. In short, you can, but you need to modify code.
Title: Re: NGUI: HUD Text
Post by: AliceD on September 07, 2015, 05:36:49 AM
Hello Mr. ArenMook,

I was wondering if the HUD text asset is compatible with the latest version of Unity and if it will be supported with future releases of Unity?

Thanks in advance for your response.

Best wishes and all the luck in the world,
AliceD
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 13, 2015, 06:31:48 AM
It's still compatible, yes.
Title: Re: NGUI: HUD Text
Post by: asims on November 21, 2015, 08:06:19 PM
we can not print arabic words with hud text. Any arabic supoort yet ?
Title: Re: NGUI: HUD Text
Post by: ArenMook on November 25, 2015, 06:39:58 PM
You need to use a font that actually has the arabic glyphs in it, and it will work fine.
Title: Re: NGUI: HUD Text
Post by: DJVDJV on January 19, 2016, 07:48:29 AM
I want to make player name over character in game. How make it "permanent" so it does not disappear affected by curves?

+ I also want change name it during runtime.

How to do this all?
Title: Re: NGUI: HUD Text
Post by: ArenMook on January 20, 2016, 08:32:05 AM
Each game unit should instantiate their own "name" prefab and keep a reference to it. This way when you do unit.name = "Abc"; it will know to update the label's text.

I'm not sure what you mean by "does not disappear affected by curves". What curves? UIFollowTarget has an option "disableIfInvisible".
Title: Re: NGUI: HUD Text
Post by: endless on March 05, 2016, 12:30:59 AM
where are download link??
Title: Re: NGUI: HUD Text
Post by: devomage on July 11, 2016, 06:14:59 AM
where are download link??

https://www.assetstore.unity3d.com/en/#!/content/3831 (https://www.assetstore.unity3d.com/en/#!/content/3831)
Title: Re: NGUI: HUD Text
Post by: AlexeyTsoy on August 13, 2016, 08:01:05 AM
does the NGUI: HUD Text is supported? Cuz last update was a year ago
Title: Re: NGUI: HUD Text
Post by: ArenMook on August 13, 2016, 04:15:26 PM
Yes, and it should still work fine.
Title: Re: NGUI: HUD Text
Post by: AlexeyTsoy on September 26, 2016, 06:58:30 AM
Здравствуйте, не могли бы Вы подсказать, как отключать HUD Text на определенной дистанции от объекта, т.е. на расстоянии до 50 метров HUD должен быть включен, а если расстояние больше то выключен. Я пробовал менять значение "far" на камере, чтобы она не видела объект, но это ни к чему не привело, заранее спасибо за помощь.
Title: Re: NGUI: HUD Text
Post by: AlexeyTsoy on September 28, 2016, 02:42:00 AM
Hello, could you please suggest how to disable the HUD Text at a certain distance from the object, ie, at a distance up to 50 meters HUD must be enabled, and if the distance is greater than the off. I tried to change the value of "far" on the camera, so it did not see the object, but it came to nothing lead, thanks in advance for your help.
Title: Re: NGUI: HUD Text
Post by: ArenMook on September 29, 2016, 04:22:08 AM
Just write a script to do that. In Update() check the distance, if close enough, enable target game object. If too far, disable target game object. This has nothing to do with HUDText.
Title: Very strange behaviour on Android! please help
Post by: samshosho on October 08, 2016, 08:49:30 AM
This is a very strange problem i came across today.
Porting one of my IOS games to Android.
It works flawlessly in the Editor and for IOS, however building for Android device resulted in very strange behaviour!!!

The sprites that suppose to update their position according to where the player is and the target position, just don't update their position! first update cycle is done and then they just stop and sometimes disappear!

i did a debug print out to see if the position is changed when the player moves, and it updates once, then stops.

The editor is working just fine with no problem, also building for IOS has no problem. The sprits move and change their position every frame.

Basically this script is suppose to show an indication onscreen to where the next target is according the position of the player and the way he is facing.
If the indication sprite goes off screen, it keeps it inside the screen at the screen's corners.

  1.  
  2. using UnityEngine;
  3. using System.Collections;
  4.  
  5.  
  6. /// <summary>
  7. /// Example script showing how to add UI window that follows an object drawn by another camera.
  8. /// </summary>
  9.  
  10. [AddComponentMenu("NGUI/Examples/Unit HUD")]
  11. public class UnitHUD : MonoBehaviour
  12. {
  13.     /// <summary>
  14.     /// Target object this UI element should follow.
  15.     /// </summary>
  16.  
  17.     public Transform target;
  18.  
  19.     Transform mTrans;
  20.     Camera mGameCam;
  21.     Camera mUICam;
  22.     Vector3 mPos;
  23.     bool mVisible = true;
  24.     public float YAdjustFactor = 2f;
  25.     public Transform Player;
  26.     private UIWidget MyWidget;
  27.  
  28.     public bool ChangeColor;
  29.  
  30.     void Start ()
  31.     {
  32.         mTrans = transform;
  33.         //target = mTrans;
  34.         if (target == null) { Destroy(gameObject);
  35.  
  36.             return; }
  37.  
  38.         mGameCam = NGUITools.FindCameraForLayer(target.gameObject.layer);
  39.         mUICam = NGUITools.FindCameraForLayer(gameObject.layer);
  40.         MyWidget = gameObject.GetComponentInChildren<UIWidget>();
  41.     }
  42.  
  43.     void LateUpdate()
  44.     {
  45.         if (target == null) { Destroy(gameObject); return; }
  46.         if (!target.gameObject.activeInHierarchy) {gameObject.SetActive(false); return;}
  47.         Vector3 screenpos = Camera.main.WorldToScreenPoint(target.position);
  48.        
  49.  
  50.         mPos = mGameCam.WorldToViewportPoint(target.position);
  51.  
  52.         bool visible = (mPos.z > 0f && mPos.x > 0f && mPos.x < 1f && mPos.y > 0f && mPos.y < 1f);
  53.      
  54.         if (visible){
  55.             mTrans.localPosition = screenpos;
  56.             MyWidget.enabled = false;
  57.         }
  58.         else {
  59.          
  60.             if (mPos.z < 0)
  61.                 mPos *= -1;
  62.             //print("mpos = "+mPos);
  63.             MyWidget.enabled = true;
  64.             mPos.x = Mathf.Clamp01(mPos.x);
  65.             mPos.y = Mathf.Clamp01(mPos.y);
  66.             //print("mpos Clamped = "+mPos);
  67.  
  68.             if(mPos.x > 0.95f)
  69.                 mPos.x = 0.95f;
  70.          
  71.             if(mPos.y > 0.95f)
  72.                 mPos.y = 0.95f;
  73.          
  74.  
  75.             if(mPos.x < 0.05f)
  76.                 mPos.x = 0.05f;
  77.          
  78.             if(mPos.y < 0.05f)
  79.                 mPos.y = 0.05f;
  80.          
  81.          
  82.             mPos = mUICam.ViewportToWorldPoint(mPos);
  83.             mPos = MyWidget.transform.parent.InverseTransformPoint(mPos);
  84.             mPos.z = 0;
  85.             MyWidget.transform.localPosition = mPos;
  86.         }
  87.     }
  88. }
  89.  
Title: Re: NGUI: HUD Text
Post by: samshosho on October 09, 2016, 06:55:01 AM
I have done all i can and tried so many different things and rebuilt 100 times, but nothing helped.
Can someone from NGUI creators answer this please.
Title: Re: NGUI: HUD Text
Post by: ArenMook on October 11, 2016, 10:59:38 AM
First guess -- turn off the multi-threaded rendering option for Android.
Title: Re: NGUI: HUD Text
Post by: samshosho on October 11, 2016, 11:02:49 AM
Not using it already!

The game is ready to be published on the Google Play, however this is the only thing that's holding it back.
What else could cause that?

note that other strange behaviour is occurring in another game, but it's not essential to the game as the one at hand. This game at hand, i have to have these Sprite indicators to show next targets.

However in the other games, it's mostly health bar, which i removed as it's not so essential to the game, until i find a solution.
Title: Re: NGUI: HUD Text
Post by: gearedgeek on February 06, 2017, 06:55:18 PM
I'm looking to add this to my project and I need help trying to get it working with the AI health. I would like to use playmaker if possible.
Title: Re: NGUI: HUD Text
Post by: ArenMook on February 08, 2017, 09:00:57 AM
I don't know either of those two extensions, so can't be of much help. HUDText is ridiculously simple to use via code though. The readme explains the few steps involved.