Error on visual scripting : Destroying assets is not permitted to avoid data lost

On 2D game

please help me :frowning:

A screenshot of the code :

This happens when you try to destroy a prefab instead of the instantiated object you made from the prefab.

This is the visual scripting forum here: Unity Engine - Unity Discussions

Dekker is correct in that you’re trying to destroy the prefab template instead of the object that you’ve instantiated.

Use the Instantiate nodes output, which is the object you just instantiated and the cache it to a Graph variable with a Set Variable node. Then use Get Variable for Destroy node’s input.