Author Topic: Displaying sprites at target's feet on XY plane  (Read 2205 times)

sendatsu_yoshimitsu

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Displaying sprites at target's feet on XY plane
« 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?
« Last Edit: July 06, 2014, 09:11:36 PM by sendatsu_yoshimitsu »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Displaying sprites at target's feet on XY plane
« Reply #1 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.

sendatsu_yoshimitsu

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Displaying sprites at target's feet on XY plane
« Reply #2 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Displaying sprites at target's feet on XY plane
« Reply #3 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.