Search Unity

What is the best way to judge whether asset exists by given path?

Discussion in 'World Building' started by Bagazi, Mar 26, 2021.

  1. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    Is there some api of assetdatabase to do this?
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Can you simply try to Resources.Load it, and see if you get back null?
     
  3. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    It works. But I dont need to Instantiate an entity nor load it into memory...
     
  4. Mortalanimal

    Mortalanimal

    Joined:
    Jun 7, 2014
    Posts:
    568
    Example:
    private string TextMeshProEssentialsDir = "Packages/com.unity.textmeshpro/Package Resources/TMP Essential Resources.unitypackage";
    if (File.Exists(TextMeshProEssentialsDir)){}