Open fgeorg opened 10 years ago
I would not recommend setting userInteractionEnabled in the touch callbacks. That is dubious design. Setting userInteractionEnabled will force the list of rebuild. While it is not an overly costly operation, it might be better to maintain your own enabled state, if you change it frequently.
Bug happens on release-3.1.1 [270f12f] but I don't think it's new. This bug is sporadic and hard to reproduce, but it seems to be a problem with cocos. We have a CCNode and we set its userInteractionEnabled to and NO then YES in quick succession while touches are happening. It then gets stuck in a state where the CCNode doesn't get touch callbacks even though userInteractionEnabled=YES. It seems to me that the problem is that the responderManager sometimes doesn't update it's responder list correctly. I fixed the problem with a temporary workaround by calling
[[CCDirector sharedDirector].responderManager markAsDirty];
at the beginning of the node's touchEnded callback.