Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: jimbbq on March 29, 2014, 01:52:03 PM

Title: tooltil not showing.
Post by: jimbbq 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("");
   }



Title: Re: tooltil not showing.
Post by: ArenMook 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.
Title: Re: tooltil not showing.
Post by: jimbbq 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?
Title: Re: tooltil not showing.
Post by: ArenMook on April 01, 2014, 07:58:00 AM
Why would you key in \n in inspector? Just press Enter to create a new line.
Title: Re: tooltil not showing.
Post by: jimbbq on April 01, 2014, 04:09:24 PM
I did try pressing enter, it won't work....  :'(

Title: Re: tooltil not showing.
Post by: ArenMook 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?
Title: Re: tooltil not showing.
Post by: jimbbq 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....

Title: Re: tooltil not showing.
Post by: ArenMook 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.