AssetDatabase.IsValidFolder doc says it's absolute, but is actually relative to project

Hey there,

So at Unity - Scripting API: AssetDatabase.IsValidFolder that page says “Given an absolute path to a folder,” which means it should be the absolute path, which goes to the drive letter. However, the root path of that function actually goes to the project folder; it’s not absolute. So if my project was in D:\Unity\MyProject, AssetDatabase.IsValidFolder(“D:\Unity\MyProject\Assets”) would return false, but AssetDatabase.IsValidFolder(“Assets”) would return true.

2 Likes

Hi! Thanks for spotting that and reporting it. I’ll add it to our list.

Thanks for posting about this. I thought I was going crazy, heh.

+1 for fixing this

Still not fixed… It is still relative, and takes the assets directory as root (Unity v.5.6).
I think I should use System.IO methods instead… I could use Assets as roots, but later on Unity might change this and I would have to find the error, remind what was the problem and then fix it.

In Unity2017.f3 this is still not fixed. Honestly I prefer getting the project path, so It’d be cool to see a parameter to get either one.

And what :)? Still doesn’t fixed)))

Great man!
only 1 year later and it’s still not working :')

Fortunately Unity has added Report links in the Documentation so you can report stuff like this. Just reported it.

Finally This is resolved! on 2020.3 docs.

7628308--949282--upload_2021-11-4_18-59-3.png

Congratulation

2 Likes