Hello, first post here…
i am on 3.7 right now and experiene a wierd problem with reparenting sprites.
When testing in chrome, everything is fine. When testing on ios i get this:
jsb: ERROR: File /Users/jenkins/Work/CocosPackageAuto/CocosFramework/cocos2d-x/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp: Line: 1479, Function: js_cocos2dx_Node_addChild
Invalid Native Object
this happens after bevor trying to add the child again:
elementSprite.removeFromParent(true);
console.log("A. elementSprite removed + " + elementSprite);
// add the removed node to its new parent node
console.log("this.currentLevelNode = " + this.currentLevelNode);
// bad things happening now on iOS:
this.currentLevelNode.addChild(elementSprite);
The node i want to reparent is a custom one starting like this:
var ElementNode = cc.Node.extend( {
gridArray: [],
ctor: function() {
this._super();
cc.associateWithNative( this, cc.Node );
},
i read somewhere that cc.associateWithNative would solve the issue, but it does not.
Any ideas?