Search Unity

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

Discussion in 'Asset Database' started by YarnballSoftware, Jun 10, 2016.

  1. YarnballSoftware

    YarnballSoftware

    Joined:
    May 18, 2016
    Posts:
    1
    Hey there,

    So at https://docs.unity3d.com/ScriptReference/AssetDatabase.IsValidFolder.html 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.
     
    SaSha_K and andrew-lukasik like this.
  2. Alex_May

    Alex_May

    Joined:
    Dec 29, 2013
    Posts:
    198
    Hi! Thanks for spotting that and reporting it. I'll add it to our list.
     
  3. burtonposey

    burtonposey

    Joined:
    Sep 8, 2009
    Posts:
    62
    Thanks for posting about this. I thought I was going crazy, heh.
     
  4. andrew-lukasik

    andrew-lukasik

    Joined:
    Jan 31, 2013
    Posts:
    249
    +1 for fixing this
     
  5. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    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.
     
  6. auhfel

    auhfel

    Joined:
    Jul 5, 2015
    Posts:
    92
    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.
     
  7. RKTeam

    RKTeam

    Joined:
    Nov 29, 2016
    Posts:
    6
    And what :)? Still doesn't fixed)))
     
  8. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Great man!
    only 1 year later and it's still not working :')
     
  9. npatch

    npatch

    Joined:
    Jun 26, 2015
    Posts:
    247
    Fortunately Unity has added Report links in the Documentation so you can report stuff like this. Just reported it.
     
  10. ggzerosum

    ggzerosum

    Joined:
    Sep 26, 2017
    Posts:
    33