Author Topic: UIButton.collider disabled  (Read 2918 times)

tbrewerart

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
UIButton.collider disabled
« on: August 06, 2013, 07:57:50 AM »
I’m making a level unlock system using UIButton with the box collider disabled.  I am having trouble using NGUI Tools to enable them.  Consequently, I am using the above Unity code with mixed results.

I simply want to activate the box collider on the UIButton, enabling it and restoring its color. Am I using SetActiveChildren appropriately?
Is there a better way?

Thank you for any help you might offer.

  1. int n = 0;
  2.                 for(int i=0; i<maxLevels; i++)
  3.                 {                                              
  4.                                 if(n <= Misc.getMaxLevel())
  5.                                 {
  6.                                         //NGUITools.SetActiveChildren(planetButton[n], true);
  7.                                         planetButton[n].collider.enabled = true;
  8.                                                
  9.                                                 Misc.setStartSpawnerIndex(0);
  10.                                                 Misc.setStartRound(1);
  11.                                                                                        
  12.                                 }else{
  13.                                         //NGUITools.SetActiveChildren(planetButton[n], false);
  14.                                           planetButton[n].collider.enabled = false;                                    
  15.                                 }
  16.                                 n++;
  17.                 }
  18.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButton.collider disabled
« Reply #1 on: August 07, 2013, 05:39:02 AM »
UIButton.isEnabled is for that.