2D Toolkit Forum

2D Toolkit => Support => Topic started by: cloudchen on August 30, 2013, 12:25:12 pm

Title: How could I bind/unbind the event of the uiItem dynamically?
Post by: cloudchen on August 30, 2013, 12:25:12 pm
I have lots of GameObjects in the scene, and each of them attached a tk2dUIItem object. Since the event(method) bound to each of the GameObject need some time to wait the completeness of the AssetBundle download job, I would like to avoid user triggering the event bound to other GameObject during the period of loading.

How could I toggle the bound event dynamically or there are other better solutions? Thanks and wait for your kindly aid.
Title: Re: How could I bind/unbind the event of the uiItem dynamically?
Post by: unikronsoftware on August 30, 2013, 12:36:55 pm
How are you binding the event in the first place? Is it by drag and drop? If so - simply set the SendMessageOnClickMethodName = "" and then set it back when you're done.

Otherwise, simply unsubscribe from the event and resubscribe later when its enabled.