Cocos Creator API


Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.


: cc

: !#en Please use cc.NodePool instead !#zh 请使用 cc.NodePool 代替

Attention: In creator, it's strongly not recommended to use cc.pool to manager cc.Node. We provided cc.NodePool instead.

cc.pool is a singleton object serves as an object cache pool.
It can helps you to improve your game performance for objects which need frequent release and recreate operations

  • obj

Put the obj in pool.

obj Object

The need put in pool object.


var sp = new _ccsg.Sprite("a.png");
cc.pool.getFromPool(_ccsg.Sprite, "a.png");

  • objClass

Check if this kind of obj has already in pool.

objClass Object

The check object class.


: Boolean

If this kind of obj is already in pool return true,else return false.

removeObject ( )

Remove the obj if you want to delete it.

getFromPool ( ) Any

Get the obj from pool.


: Any

Call the reuse function an return the obj.

drainAllPools ( )

Remove all objs in pool and reset the pool.

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index