Author Topic: Label is not drawing  (Read 2539 times)

primus88

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 50
    • View Profile
Label is not drawing
« on: September 08, 2013, 03:30:23 PM »
Hello guys,

I have this label which I want it to be drawn when a certain condition is passed. The code :

  1. void OnMouseUp()
  2.         {
  3.                 GameObject theCamera = GameObject.Find("MapCamera");
  4.                                 CommonCrap zaScript = theCamera.GetComponent<CommonCrap>();
  5.                         if(attack3 == 1)
  6.                         {
  7.                                 NGUITools.SetActive(zaScript.labelAttack.gameObject,true);     
  8.                                 Debug.Log(zaScript.labelAttack.gameObject);
  9.                         }
  10.                        
  11.                         if(challenge3 == 1)
  12.                         {
  13.                                 NGUITools.SetActive(zaScript.labelChallenge.gameObject,true);  
  14.                         }      
  15.         }

The debug log return exactly the object I want (which is the label) but to no avail, the label is not drawn on the screen.

Can you guys help me up with this?

Thank you

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Label is not drawing
« Reply #1 on: September 08, 2013, 03:45:33 PM »
Is the UILael component enabled? Is the depth such that the label is above the widgets below?

primus88

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 50
    • View Profile
Re: Label is not drawing
« Reply #2 on: September 08, 2013, 03:57:18 PM »
Yes, the label normally works fine. I found the problem.

I have the same script which I put it on 15 prefabs, which I spawn when I enter the scene and 5 objects already in game.
If I leave the script on any of the 5 objects already in game, it creates this problem.
If I remove it and leave it only on the 15 spawned prefabs than it works perfectly.

Anyone else encountered this ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Label is not drawing
« Reply #3 on: September 09, 2013, 01:05:52 AM »
OnMouseUp is a Unity callback. OnHover(bool isOver) is an NGUI callback.