コード例 #1
0
ファイル: AssetMenu.cs プロジェクト: Qn880914/IGGGame
    private static void CheckSelectedObject()
    {
        bool bAllOK = true;

        foreach (GameObject gameObj in Selection.gameObjects)
        {
            string errorMsg = ModelAssetValidation.PerformanceCheckModelPrefab(gameObj);
            bool   bPassed  = string.IsNullOrEmpty(errorMsg);

            if (bPassed)
            {
                Debug.Log("Asset '" + gameObj.name + " passed.", gameObj);
            }
            else
            {
                Debug.LogError(errorMsg, gameObj);
            }

            bAllOK = bAllOK && bPassed;
        }

        if (!bAllOK)
        {
            EditorUtility.DisplayDialog("Performance Warning", "Some of the selected assets failed our Project Import and Performance settings.  Check the log window for details!", "Thanks!");
            EditorApplication.ExecuteMenuItem("Window/Console");
        }
    }
コード例 #2
0
ファイル: AssetMenu.cs プロジェクト: Qn880914/IGGGame
    private static void CheckFileDirObjectTest()
    {
        List <string>     listPath = new List <string>();
        List <GameObject> listgo   = new List <GameObject>();
        string            Path     = "";

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

        if (guid2.Length == 0)
        {
            Debug.Log("本目录不存在gameobject");
            return;
        }

        foreach (var guid in guid2)
        {
            GameObject go = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid), typeof(GameObject)) as GameObject;
            listgo.Add(go);
        }

        bool bAllOK = true;

        foreach (GameObject gameObj in listgo)
        {
            string errorMsg = ModelAssetValidation.PerformanceCheckModelPrefab(gameObj);
            bool   bPassed  = string.IsNullOrEmpty(errorMsg);

            if (!bPassed)
            {
                Debug.LogError(errorMsg, gameObj);
            }

            bAllOK = bAllOK && bPassed;
        }

        if (!bAllOK)
        {
            EditorUtility.DisplayDialog("Performance Warning", "Some of the selected assets failed our Project Import and Performance settings.  Check the log window for details!", "Thanks!");
            EditorApplication.ExecuteMenuItem("Window/Console");
        }
    }