Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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:
    239
    +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:
    385
    Great man!
    only 1 year later and it's still not working :')
     
  9. npatch

    npatch

    Joined:
    Jun 26, 2015
    Posts:
    227
    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:
    31