Author Topic: UIButton help pls (NGUI 3.4.8) ?  (Read 1748 times)

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
UIButton help pls (NGUI 3.4.8) ?
« on: February 07, 2014, 06:59:36 AM »
How to set Notify field by code ? And why UIButton component being disabled after Play Unity ? I would like set Notify field to instantiated GameObject with UIButton component by code.
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButton help pls (NGUI 3.4.8) ?
« Reply #1 on: February 08, 2014, 02:13:48 PM »
The only reason UIButton would be disabled is if you have nothing for that button to color. You get a warning about it in the console log.

Use EventDelegate.Add to set the On Click notification from code:
  1. UIButton btn = GetComponent<UIButton>();
  2. EventDelegate.Add(btn.onClick, YourClickFunction);