Nodes in the NodePool

Nodes in the NodePool
0.0 0


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++)
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 :roll_eyes:
P.S.2 Could not decorate the code nicely :frowning_face:


Im using nodepool with sprites and it works just fine.


Hmm… If I use prefab, rather than a manually created node, then the spriteFrame property of the receive from node is preserved.


I use them with prefabs of course.