Hi all,
I’m trying to create a test for an editor plugin that beneath other functionality imports required unity packages from a given location. The test shall verify that the correct packages were imported by cheking the assets in the file system. The test itself already works fine, but I have an issue when cleaning up: The problem is that the test cannot delete the folder that it imported after its work is done (using NUnit / TearDown function I’m trying to delete a folder named “CommonImport” directly located in the “Assets” folder). Using the System.IO.Directory.Delete I’m getting an excepion:
System.UnauthorizedAccessException : Access to the path ‘D:<some_path>\Unity\MyProject\Assets\CommonImport\TestAsset1’ is denied.
Using the AssetDatabase.DeleteAsset there is no error but the folder is still there after the call completes. I tried to remove the files in the folder first, but still the result is the same.
So my question: What is the correct way to remove this folder OR - in my opinion even better - can I somehow tell the test to change the asset folder / package import target to a different location during its runtime?
Thanks,
Thomas