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. Dismiss Notice

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:
    607
    Is there some api of assetdatabase to do this?
     
  2. JoeStrout

    JoeStrout

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

    Bagazi

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

    Mortalanimal

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