Tuesday, April 16, 2024
HomeSample Page

Sample Page Title


Hi, I’m attempting to destroy a node in Contact2DType.BEGIN_CONTACTcallback however get

You are attempting to destroy a object twice or extra. error.

I’m additionally checking for

if (this.node && this.node.isValid) this.node.destroy();

simply to make sure, however nothing adjustments.

If I wait fo the subsequent loop it really works as anticipated

        setTimeout(() => {
            if (this.node && this.node.isValid) this.node.destroy();
        }, 0)

Any recommendation ?

This error will be debugged right here to see the place it’s coming from.

I had related points over time with for instance destroy() and instantiate(), they’re synchronous capabilities, however isn’t generated or destroyed fully synchronously, so it’s a must to mess around with setTimeout() generally to make sure you don’t crash your software program. This happes totally on greater scenes/prefabs and/or slower gadgets.

A number of years again I made a difficulty about this on Cocos github, my instance wasn’t the very best, since it’s onerous to copy on a recent small sport and the ticket acquired closed .

thanks, it’s not a giant difficulty to maneuver onto the subsequent occasion loop however what’s unusual is that I can’t see others having this difficulty right here within the discussion board. Anyway this thread incorporates a attainable repair and a proof, it’s tremendous to me.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments