public static void Run(bool deleteMissings)
    {
        var reports = ScanAssets.Report <MissingData>(CollectAssets.Collect(CollectAssets.Target.Hierarchy), ScanMissingAssets.Scan);

        if (0 < reports.Count)
        {
            var sb = new StringBuilder(1024);
            foreach (var missing in reports)
            {
                sb.Append(missing.ToString()).Append('\n');
            }

            sb.Append("MISSING COUNT:").Append(reports.Count);

            if (deleteMissings)
            {
                foreach (var missing in reports)
                {
                    var go      = missing.owner;
                    var indexes = missing.indexes;

                    var so   = new SerializedObject(go);
                    var prop = so.FindProperty("m_Component");

                    for (int n = indexes.Count - 1; n >= 0; --n)
                    {
                        prop.DeleteArrayElementAtIndex(indexes[n]);
                    }

                    so.ApplyModifiedProperties();
                    EditorUtility.SetDirty(go);
                    UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(go.scene);
                }
            }

            Debug.Log(sb.ToString());
        }
        else
        {
            Debug.Log("MISSING NOT FOUND!");
        }
    }
Beispiel #2
0
        public static void Run()
        {
            var reports = ScanAssets.Report <string>(CollectAssets.Collect(CollectAssets.Target.Hierarchy), ScanNonCachedOImages.Scan);

            if (0 < reports.Count)
            {
                var sb = new StringBuilder(1024);
                foreach (string log in reports)
                {
                    sb.Append(log).Append('\n');
                }

                sb.Append("NON-CACHED COUNT:").Append(reports.Count);

                Debug.Log(sb.ToString());
            }
            else
            {
                Debug.Log("NON-CACHED NOT FOUND!");
            }
        }