コード例 #1
0
 private static void FindMissingReference(string sceneName, GameObject go)
 {
     Component[] coms;
     if (string.IsNullOrEmpty(sceneName))
     {
         coms = go.GetComponentsInChildren <Component>();
     }
     //如果检测目标是场景,则只需要检测go上的所有组件,不需要检测go的children,因为FindObjectsOfType已经包含了children
     else
     {
         coms       = go.GetComponents <Component>();
         sceneName += "场景/";
     }
     for (int j = 0; j < coms.Length; j++)
     {
         if (null == coms[j])
         {
             AssetCheckLogger.Log(sceneName + go.name + "丢失了组件");
             continue;
         }
         SerializedObject   so = new SerializedObject(coms[j]);
         SerializedProperty sp = so.GetIterator();
         while (sp.NextVisible(true))
         {
             if (sp.propertyType == SerializedPropertyType.ObjectReference)
             {
                 if (sp.objectReferenceValue == null && sp.objectReferenceInstanceIDValue != 0)
                 {
                     AssetCheckLogger.Log(sceneName + FullObjectPath(coms[j]) + "/" + coms[j].GetType() + "." + sp.propertyPath + "丢失了引用");
                     //Debug.LogError(sceneName + FullObjectPath(coms[j]) + "/" + coms[j].GetType() + "." + sp.propertyPath + "丢失了引用", go);
                 }
             }
         }
     }
 }
コード例 #2
0
    private static void AutoCheckTextureFormat()
    {
        int  totalCount;
        long totalMem;
        List <TextureData> outputs = DoCheckTextureFormat("Assets", out totalCount, out totalMem);

        AssetCheckLogger.Log("TotalCount:" + totalCount + "\t" + "TotalMem:" + ConvertToString(totalMem) + "(editor下检测的内存大概是实际使用的两倍,具体大小取决于真机。另外这里统计了所有贴图,包含没有被打进包里的。)");
        for (int i = 0; i < outputs.Count; i++)
        {
            AssetCheckLogger.Log(outputs[i].Message);
        }
        outputs.Clear();
    }