I have a node ‘orange’, in its ‘spriteFrame’ property, I set the image, it is displayed. I put this node in ‘NodePool’, and when I get it from ‘NodePool’, the ‘spriteFrame’ property = null, the node is not displayed.
var test1 = orange.getComponent(cc.Sprite);
console.log(test1.spriteFrame); // show cc_SpriteFrame
this.orangePool = new cc.NodePool();
var amountOrange = 5;
for (var i = 0; i < amountOrange; i++)
{
this.orangePool.put(cc.instantiate(orange));
};
var orange2 = this.orangePool.get();
console.log(orange2); // show cc_Node
var test2 = orange2.getComponent(cc.Sprite);
console.log(test2.spriteFrame) // show null
What is the reason?
P.S. I apologize if it’s unclear. I’m writing using a Google Translate
P.S.2 Could not decorate the code nicely