creater的碰撞检测与对象池共同使用产生bug

Creator 版本号:1.3
运行时目标平台:(Web
手机浏览器平台:(chrome
操作系统:win10
做了什么操作引起的 Bug:
使用内存池装prefab,一个prefab添加了BoxCollider,在被重新获取使用时不再进行碰撞检测。同时reuse也没有被调用,源码目前删除了这段代码。

源码1:
cc.Class({
extends: cc.Component,

properties: {
    prebRed: cc.Prefab,
    prebBlue: cc.Prefab,
    prebYellow: cc.Prefab
},

// use this for initialization
onLoad: function () {
    let initCount = 10;
    this._pools = {};
    this.redPool = new cc.NodePool();
    for (let i = 0; i < initCount; ++i) {
        let bullet = cc.instantiate(this.prebRed); // 创建节点
        this.redPool.put(bullet); // 通过 putInPool 接口放入对象池
    }
    this._pools[dc.skillType.RED] = this.redPool;

    this.bluePool = new cc.NodePool();
    for (let i = 0; i < initCount; ++i) {
        let bullet = cc.instantiate(this.prebBlue); // 创建节点
        this.bluePool.put(bullet); // 通过 putInPool 接口放入对象池
    }
    this._pools[dc.skillType.BLUE] = this.bluePool;

    this.yellowPool = new cc.NodePool();
    for (let i = 0; i < initCount; ++i) {
        let bullet = cc.instantiate(this.prebYellow); // 创建节点
        this.yellowPool.put(bullet); // 通过 putInPool 接口放入对象池
    }

    this._pools[dc.skillType.YELLOW] = this.yellowPool;
},
createBullet: function (t) {
    let bullet = null;
    var pool = this._pools[t];
    if (pool){
        cc.log(t + "createBullet : " + pool.size());
        if (pool.size() > 0) { // 通过 size 接口判断对象池中是否有空闲的对象
            bullet = pool.get();
        } else { // 如果没有空闲对象,也就是对象池中备用对象不够时,我们就用 cc.instantiate 重新创建
            if (t == dc.skillType.RED){
                bullet = cc.instantiate(this.prebRed); // 创建节点
            }else if (t == dc.skillType.BLUE){
                bullet = cc.instantiate(this.prebBlue); // 创建节点
            }else if (t == dc.skillType.YELLOW){
                bullet = cc.instantiate(this.prebYellow); // 创建节点
            }
        }

        bullet.parent = this.node; // 将生成的敌人加入节点树
    }

    return bullet;
},
putBullet: function (old) {
    // old.removeFromParent();
    // old.parent = null;
    var pool = this._pools[old.name];
    if (pool){
        pool.put(old);
        cc.log(old.name + "putBullet : " + pool.size());
    }
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {

// },

});

源码2:
cc.Class({
extends: cc.Component,

properties: {
    actor : {
        default : null,
        type : cc.Sprite
    }
},

// use this for initialization
onLoad: function () {
    this.node.runAction(cc.moveBy(2,cc.p(-1280,0)));
},
/**
 * 当碰撞产生的时候调用
 * @param  {Collider} other 产生碰撞的另一个碰撞组件
 * @param  {Collider} self  产生碰撞的自身的碰撞组件
 */
onCollisionEnter: function (other, self) {
    //被复用的组件不会再次进入这里,导致了对象池数量无法恢复
    var manager = Finder.normal(Finder.key.Skill).getComponent("BulletManager");
    return manager.putBullet(bullet);
}

// called every frame, uncomment this function to activate update callback
// update: function (dt) {

// },

});

看使用方法貌似没问题,可以上传个 demo 看看吗

我现在也是遇到了这个问题。reuse不知道为何不会被调用,然后对象池的size恒为1