- Home /
Question by
Inok · Jan 23, 2015 at 01:18 AM ·
optimization
Cases for use Button.onClick.RemoveAllListeners().
When i destroy button i not need to call something like that: Button.onClick.RemoveAllListeners()? When i use events based on delegates its important to unsubscribe from events when script that use events destroyed. But what about Button.onClick.AddListener?
Comment
Best Answer
Answer by InvincibleCat · Jan 23, 2015 at 01:20 AM
If you mean that if you call Button.onClick.AddListener somewhere you need to call something OnDestroy.
The answer is no.
Your answer
![](https://koobas.hobune.stream/wayback/20220613181229im_/https://answers.unity.com/themes/thub/images/avi.jpg)