如下图,put一运行页面就崩溃:
跟踪检查过,troopPool是正常实例化的
详细报错信息:
Uncaught Error
at b2Body.SetActive (box2d.umd.js:7181:15)
at b2RigidBody2D.setActive (rigid-body.ts:231:21)
at b2RigidBody2D.onDisable (rigid-body.ts:82:14)
at RigidBody2D.onDisable (rigid-body-2d.ts:543:24)
at ComponentScheduler.disableComp (component-scheduler.ts:438:22)
at NodeActivator._deactivateNodeRecursively (node-activator.ts:316:50)
at NodeActivator.activateNode (node-activator.ts:186:18)
at Node._onHierarchyChangedBase (node.ts:1323:46)
at Node._onHierarchyChanged (node.ts:1798:14)
at Node.setParent (node.ts:469:14)
SetActive @ box2d.umd.js:7181
setActive @ rigid-body.ts:231
onDisable @ rigid-body.ts:82
onDisable @ rigid-body-2d.ts:543
disableComp @ component-scheduler.ts:438
_deactivateNodeRecursively @ node-activator.ts:316
activateNode @ node-activator.ts:186
_onHierarchyChangedBase @ node.ts:1323
_onHierarchyChanged @ node.ts:1798
setParent @ node.ts:469
set @ node.ts:217
removeChild @ node.ts:734
removeFromParent @ node.ts:722
put @ node-pool.ts:130
onEndContact @ troopControlScript.ts:56
emit @ callbacks-invoker.ts:344
emit @ physics-contact.ts:241
_onEndContact @ physics-world.ts:404
EndContact @ physics-contact-listener.ts:70
Update @ box2d.umd.js:11806
Collide @ box2d.umd.js:12479
Step @ box2d.umd.js:19588
step @ physics-world.ts:161
postUpdate @ physics-system.ts:290
tick @ director.ts:724
_updateCallback @ game.ts:1015
updateCallback @ pacer-web.ts:89
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
requestAnimationFrame (async)
updateCallback @ pacer-web.ts:86
index.js:83 WebSocket is already in CLOSING or CLOSED state.
(anonymous) @ index.js:83
e.encodePacket @ index.js:83
(anonymous) @ index.js:83
r.write @ index.js:83
r.send @ index.js:83
r.flush @ index.js:83
r.sendPacket @ index.js:83
r.ping @ index.js:83
(anonymous) @ index.js:83