Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: sendatsu_yoshimitsu on July 06, 2014, 09:00:06 PM

Title: Displaying sprites at target's feet on XY plane
Post by: sendatsu_yoshimitsu on July 06, 2014, 09:00:06 PM
I'm trying to use NGUI and the HUDText extension to place a circular disk on the ground under the feet of an NPC to use as a generic healthbar/indicator. My current hierarchy is set up as follows:

UI Root
> UI Camera
  > Stats Container
   >A bunch of unrelated sprites and labels that indicate player status. These all work fine.

Outside of UI Root, I made an empty gameobject, attached a panel to it, and childed the sprite:

UI Panel
 > UI Sprite with healthbar & UIFollow pointed to the NPC whose feet it should stay under


I can see everything under my UI Root fine, but nothing in the second UI panel shows up. Is my workflow completely wrong?
Title: Re: Displaying sprites at target's feet on XY plane
Post by: ArenMook on July 07, 2014, 03:56:17 AM
Did you adjust its scale? By default if you leave it at (1, 1, 1), then your widget will be huge, as 1 pixel will represent 1 in-game unit, which is 1 meter in Unity by default. 1 pixel = 1 meter = huge UI element.

Also make sure that world panel's layer is set to something your 3D camera can see.
Title: Re: Displaying sprites at target's feet on XY plane
Post by: sendatsu_yoshimitsu on July 07, 2014, 05:30:39 AM
So I'm a dolt, I had everything configured right but I forgot to add a UICamera to my main camera, thank you! :)

While I have you, I was hoping you could clarify two quick, unrelated things:

1) Am I correct that press & hold functionality isn't currently supported on UIbuttons (e.g. repeatedly fire the supplied method for as long as the button is being held down)?

2) What is the exact context I should be using a HUDRoot in? I noticed you used it in the HUD panel in the example scene, but I can't figure out what it's doing.
Title: Re: Displaying sprites at target's feet on XY plane
Post by: ArenMook on July 08, 2014, 07:31:16 AM
1. There is no repeated fire in NGUI. If you need that, simply set a flag in OnPress(true) and check it in Update, or just start a coroutine.

2. It's used to make HUDText items show underneath it. It's basically so that NGUI knows where to put them.