Author Topic: tooltil not showing.  (Read 6313 times)

jimbbq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
tooltil not showing.
« on: March 29, 2014, 01:52:03 PM »
Hi

I copied the tooltip object from the Character example scene from NGUI.

I want the tooltip to show on a button when I hover over it.

How can I achieve this?

thanks!
Jim


[edit] I made it work now with the following. However \n does not create a line break. How can I create a line break? Also how can I set the alpha value of the tooltip ? It is semi-transparent and I want it appear in solid colour. thanks!

   public string tooltiptext = "Human\n Resources";

   void OnTooltip(bool show) {
      if (show)
         UITooltip.ShowText(tooltiptext);
      else
         UITooltip.ShowText("");
   }



« Last Edit: March 29, 2014, 04:58:24 PM by jimbbq »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: tooltil not showing.
« Reply #1 on: March 30, 2014, 07:10:20 AM »
\n does create a line break, assuming the label actually supports multiple lines.

Re: value: check its hierarchy. Alpha is cumulative, so if you set some parent widget / panel to be semi-transparent, then all children will be as well.

jimbbq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
Re: tooltil not showing.
« Reply #2 on: March 31, 2014, 04:50:32 PM »
somehow \n does not work when I key in the string in the inspector window...is it a Unity bug?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: tooltil not showing.
« Reply #3 on: April 01, 2014, 07:58:00 AM »
Why would you key in \n in inspector? Just press Enter to create a new line.

jimbbq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
Re: tooltil not showing.
« Reply #4 on: April 01, 2014, 04:09:24 PM »
I did try pressing enter, it won't work....  :'(


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: tooltil not showing.
« Reply #5 on: April 02, 2014, 06:27:36 PM »
...? Why not? What version are you using? What OS? How is it that basic Unity's functionality of being able to press Enter to start a new line while editing a UILabel's textbox in inspector suddenly doesn't work in your case?

jimbbq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
Re: tooltil not showing.
« Reply #6 on: April 03, 2014, 06:04:42 AM »
I am using unity 4.3 and I have the latest version of NGUI (I just bought it a week ago)

When I create a new NGUI label, I can press enter to create line break, but when I define my own string (see below)

public string tooltipText;

In the inspector, I can't press enter.....using \n won't make a line break either.... a bit stuck really....


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: tooltil not showing.
« Reply #7 on: April 03, 2014, 08:55:21 PM »
When you define your own you need to add a [Multiline] tag to it.
  1. [Multiline]
  2. public string yourMultilineString;
Editor scripting is not an NGUI question btw. This is Unity, not NGUI.