Delete an empty directory

I’m trying to delete a directory but first deleting its contents then deleting the folder itself. However, when i use Directory.Delete(), it doesn’t delete the directory and gives me a console warning saying:

Is there a way of stopping this happening?
Thanks

Your answer is right there in the warning. Delete the .meta file corresponding to the folder you want to delete.

1 Like

You should delete the folder via Unity - Scripting API: AssetDatabase.DeleteAsset which will automatically handle removing the .meta file for you.

1 Like