I am facing issue as mentioned below , i am using cocos2d-x 2.0 …
" Error is assertion failed: (0), function forceAddHandler file /Users/…/libs/cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp, line 121 "
i am using the sneaky button joystick in game…
I am not getting how to overcome… …
Please help me if someone solved this issue ….
If you are porting and you had ported the line self.isTouchEnabled = YES;, you should comment that line.
cocos2d-x has handled this in a different way, which makes touches work by plainly adding the touch delegate.
fuuu, I got the same problem and finnally solved it
But firstly, where and when you got that Error.
For me, it happened when I recalled the
Init()
function of the layer. When the Init() is called, cocos2d-x automatically sets touchEnable = false at first, and somehow, I don’t understand, the command
this->setTouchEnable=true
in my Init() function causes the error accidentally. So the solution is that I setTouchEnable=false by myself before recalling the Init() function, something like this:@ this->setTouchEnable=false; this::init();@
It’s work!