What「The asset has been destroyed!」

In the browser, I executed the following code to delete a node.

this.node.destroy();”

Then the message “The asset has been destroyed!” appears in the console.
Every time I delete a node, I get 3 or 4 of these messages.
I created a project that only does this.node.destroy();” in each of Cocos ‘3.8.2’ and ‘3.8.3’, but it still happens.

Also, the description in the documentation that the node does not delete itself, but rather deletes itself from other nodes, did not work.

This is not an error, but it looks very bad and is definitely not something you want to display.

Do you know what causes this to appear or what can be done about it?

https://docs.cocos.com/creator/3.8/manual/en/scripting/life-cycle-callbacks.html,For every component in Cocos, has its life-cycle. Of course you should know clearly the node, when it will be created, and when it will be destroyed. Please make sure every time you call this.node.destroy, the node is valid. Just in case, it is better for you to add isValid() to judge whether the node is valid.

The following simple code is executed at the push of a button, but the ‘The asset has been destroyed!’ message continues to be displayed

@ccclass('TestButton')
export class TestButton extends Component {
  selectButton() {
    if (this.node.isValid) {
      log('Do destroy');
      this.node.destroy();
    }
  }
}

need help

bump
bump
bump

bump
bump
bump

this.node.isValid() is a method, not a property. Put the brackets.

In Cocos 3.8.2, ‘isValid()’ cannot be used because an error occurs.

There are no parentheses, even in the example of use in the cc.d.ts description.

Indeed, I was mistaken, I apologize.

No hay problema. Avísame si conoces alguna otra solución.


FYI.