Exemplo n.º 1
0
    private static void CheckFileDirTextureTest()
    {
        List <string>  listPath = new List <string>();
        List <Texture> listText = new List <Texture>();
        string         Path     = "";

        CheckSelectionFileDir(ref Path);
        Debug.Log(Path);
        listPath.Add(Path);
        var guid2 = AssetDatabase.FindAssets("t:texture2D", listPath.ToArray());

        foreach (var guid in guid2)
        {
            Debug.Log(AssetDatabase.GUIDToAssetPath(guid));
            Texture tex = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid), typeof(Texture)) as Texture;
            listText.Add(tex);
        }

        List <Texture> ltex = TextureAssetValidation.ValidateTextures(listText.ToArray());

        if (ltex.Count > 0)
        {
            EditorUtility.DisplayDialog("Performance Warning", "Some of the selected assets exceed the performance guidelines set for the project.  Look in the Console Window for details.", "Thanks!");
            EditorApplication.ExecuteMenuItem("Window/Console");
        }
        else
        {
            EditorUtility.DisplayDialog("Passed", "All of the selected textures conform to their rules and are deemed suitable for shipping.", "Woo hoo!");
        }
    }
Exemplo n.º 2
0
    private static void CheckSelectedTexture()
    {
        var            selectedTextures = Selection.objects.Where(x => x is Texture).Cast <Texture>();
        List <Texture> listTex          = TextureAssetValidation.ValidateTextures(selectedTextures.ToArray());

        if (listTex.Count > 0)
        {
            EditorUtility.DisplayDialog("Performance Warning", "Some of the selected assets exceed the performance guidelines set for the project.  Look in the Console Window for details.", "Thanks!");
            EditorApplication.ExecuteMenuItem("Window/Console");
        }
        else
        {
            EditorUtility.DisplayDialog("Passed", "All of the selected textures conform to their rules and are deemed suitable for shipping.", "Woo hoo!");
        }
    }