Author Topic: NGUI Buttons target and component based singleton  (Read 2124 times)

ggmann

  • Guest
NGUI Buttons target and component based singleton
« on: November 05, 2012, 03:13:06 AM »
i have  singleton GameManager, there is function Play which i want call with ButtonMessage but, i set as target GameObject with this singleton and after reloading Scene connection between ButtonMessage target and singleton loose, singleton live but target setted to the other singleton which destroy if already exist one.

what i doing wrong ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Buttons target and component based singleton
« Reply #1 on: November 05, 2012, 04:46:18 AM »
What does a singleton have to do with a button?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: NGUI Buttons target and component based singleton
« Reply #2 on: November 05, 2012, 10:57:30 AM »
Rewrite the NGUI button to use your singleton if you want to use it.

Instead of sending to target, it should just call:

GameManager.Instance.Method();