Author Topic: Tooltip doesn't work with 3D UIs?  (Read 1477 times)

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Tooltip doesn't work with 3D UIs?
« on: September 03, 2015, 06:25:34 PM »
Hi,

do Tooltips not work with 3D cameras?

The reason I ask is that I use UITooltip in a lot of places in my game and they work as intended - in a scene that only has 2D UIs.
I not added a tooltip in a scene with only a 3D UI and there the tooltip does show ... But at pos.z = -700, which is shortly before the 3D camera. If I could set the near clip plane to 0 it would maybe show up. But at 0.01 it doesn't.
As a result, I can see the tooltip in the Scene, but not in the Game preview.

Any thoughts? Thx
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Tooltip doesn't work with 3D UIs?
« Reply #1 on: September 06, 2015, 05:08:18 PM »
No, you need to use a 2D camera for tooltips or they can't be positioned properly over the mouse.

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Tooltip doesn't work with 3D UIs?
« Reply #2 on: September 09, 2015, 10:02:01 AM »
Hm, I can have a 2D and a 3D NGUI camera in the same 3D scene at the same time ... right? How would that work? The mouse-over events that are fired by the 3D camera would get picked up by the 2D tooltip camera - sounds weird to me.
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Tooltip doesn't work with 3D UIs?
« Reply #3 on: September 13, 2015, 05:10:31 AM »
Only one UICamera script will handle events regardless of how many of them you have in your scene. Just make your tooltips be shown underneath your 2D UI, that's all.

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Tooltip doesn't work with 3D UIs?
« Reply #4 on: September 15, 2015, 01:18:33 PM »
Yeah, but I don't see how. In my setup, the 3D camera receives the OnMouseOver event from the 3D menu and it's colliders, triggering the UITooltip.

How would the 2D camera fit in?
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Tooltip doesn't work with 3D UIs?
« Reply #5 on: September 20, 2015, 01:59:39 AM »
The obvious way. Place your UITooltip on the 2D UI, not your 3D UI.

UITooltip is just an example of how to show tooltips. The showing is done from the OnTooltip notification. In the NGUI's inventory example UIItemSlot.OnTooltip calls UITooltip.Show.

P.S. OnMouseOver is a UNITY event, not an NGUI event. NGUI's equivalent is OnHover (true).