Beispiel #1
0
    private void ListShaders(bool verbose)
    {
        allShaders.Clear();

        string[] shaderList = AssetDatabase.FindAssets("t: Shader");
        int      count      = 0;

        foreach (string guid in shaderList)
        {
            genericInfo entry = new genericInfo();
            entry.count = count;
            entry.path  = AssetDatabase.GUIDToAssetPath(guid);
            allShaders.Add(count, entry);

            if (verbose)
            {
                Debug.Log(count.ToString() + " : " + AssetDatabase.GUIDToAssetPath(guid));
            }
            count++;
        }

        if (verbose)
        {
            Debug.Log("");
        }
        if (verbose)
        {
            Debug.Log("Shaders total: " + allShaders.Count);
        }
    }
Beispiel #2
0
    private void ListMat(bool verbose)
    {
        allMats.Clear();
        externalMats.Clear();
        embeddedMats.Clear();

        string[] matList = AssetDatabase.FindAssets("t: Material");
        int      count   = 0;

        foreach (string guid in matList)
        {
            genericInfo entry    = new genericInfo();
            matInfo     matentry = new matInfo();
            entry.count    = count;
            entry.path     = AssetDatabase.GUIDToAssetPath(guid);
            matentry.count = count;
            matentry.path  = entry.path;

            if (entry.path.EndsWith(".mat"))  //external material
            {
                externalMats.Add(count, entry);
                if (verbose)
                {
                    Debug.Log(count.ToString() + "[external] : " + entry.path);
                }
            }
            else    //embedded material
            {
                embeddedMats.Add(count, entry);
                if (verbose)
                {
                    Debug.Log(count.ToString() + "[embedded] : " + entry.path);
                }
            }

            Material mat = AssetDatabase.LoadAssetAtPath <Material>(entry.path);
            if (mat != null)
            {
                if (verbose)
                {
                    Debug.Log(mat.name + " found, using " + mat.shader.name + " shader.");
                }
            }
            else
            {
                if (verbose)
                {
                    Debug.Log("No Material there");
                }
            }


            allMats.Add(count, matentry);

            count++;
        }

        if (verbose)
        {
            Debug.Log("");
        }
        if (verbose)
        {
            Debug.Log("Materials total: " + allMats.Count + " , external: " + externalMats.Count + " , embedded: " + embeddedMats.Count);
        }
    }