Deleting a clone when the clone is being made on another sprite

I am making A tank game when the player clicks r the game will spawn the tanks and then they battle and they can shoot bullets at each other but when the bullet hits the enemy tank it is deleting the bullet clone like it is supposed to but it is not deleting the tank clone and is coming up with the error message “Destroying assets is not permitted to avoid data loss”.

Yeah so I think your code is trying to delete the prefab itself which is a problem. Instead, try saying Object.Destroy(gameObject); Object.Destroy(coll.gameObject);

I’m new, so I might be wrong, but, @Jsmithson ,

What you are doing here is destroying an object in your projectiles script, and it appears that you are trying to destroy an object referenced in a public variable, which you would most likely set to the prefab I would guess. What you want to do is have a collision detection in the tank using the Update() function, which will have the tank destroy itself, and then the bullet detects if it hit a tank in the LateUpdate() function, meaning they will both be destroyed in the same frame.
Keep in mind I am new, but I have just gone through a problem with the destruction of objects in a shooter, so I think I know what I am saying.

Are you refrenceing a prefab? you can use a trigger colider on the bullet so it will kill itself when touched by a bullet.
you can use a onTriggerEnter if your projectile has a trigger colider or you can add one by using a mesh collider or a collider that is the right shape.

You could try this, if your prefab tanks don’t already have a collider2D on it, add it, then make sure ypur tank prefabs have a tag of “Tank”, then add a script (Make sure to add this script to the bullet prefab) and type this:

void OnCollisionEnter2D(Collision2D collision)
{
        switch(collision.gameObject.tag)
               case "Tank":
                  Destroy(collision.gameObject); //Destroys the bullet
                  Destroy(gameObject); //Destroys the tank
                break;
}