Author Topic: Widgets with alpha = 0 and colliders  (Read 3863 times)

vallcrist

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 49
    • View Profile
Widgets with alpha = 0 and colliders
« on: January 19, 2014, 03:48:54 PM »
Hello again. =)

Previously, when a sprite/widget had it's alpha value = 0, the collider was disabled automatically, has this changed, or am i doing something wrong?

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Re: Widgets with alpha = 0 and colliders
« Reply #1 on: January 19, 2014, 04:38:17 PM »
That's not how it presently is. I've written my own code to disable colliders. Added to NGUITools.cs

  1.         public static void SetEnabled (GameObject t, bool on){
  2.                 // en/disables the BoxCollider of the control
  3.                 BoxCollider[] uielements;
  4.                 uielements = t.GetComponentsInChildren <BoxCollider>();
  5.                 foreach (BoxCollider bc in uielements) {
  6.                         bc.enabled = on;
  7.                 }
  8.         }
  9.        
  10.         public static void Enable (GameObject t){
  11.                 // enables the BoxCollider of the control and children, fades it in
  12.                 SetEnabled (t, true);
  13.                 TweenAlpha.Begin(t, 0.15f, 1f);
  14.         }
  15.  
  16.         public static void Disable (GameObject t){
  17.                 // disables the BoxCollider of the control and children, fades it out
  18.                 SetEnabled (t, false);
  19.                 TweenAlpha.Begin(t, 0.15f, 0f);
  20.         }
  21.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Widgets with alpha = 0 and colliders
« Reply #2 on: January 20, 2014, 12:02:17 AM »
Was it ever like that? Thinking about it, auto-disabling the box collider on invisible widgets is a good idea, so I've gone ahead and done that for f2.