Exemple #1
0
        /// <summary>
        /// 分析关系依赖
        /// </summary>
        public void Analyze()
        {
            if (isAnalyzed)
            {
                return;
            }
            isAnalyzed = true;

            //得到依赖
            UnityEngine.Object[] deps = EditorUtility.CollectDependencies(new UnityEngine.Object[] { asset });

            var depList = from dep in deps
                          let path = AssetDatabase.GetAssetPath(dep)
                                     where !(dep is MonoScript || path.StartsWith("Resources"))
                                     select AssetDatabase.GetAssetPath(dep);

            string[] paths = depList.Distinct().ToArray();

            paths.Foreach <string>((path) =>
            {
                if (!File.Exists(path))
                {
                    return;
                }

                FileInfo fileInfo = new FileInfo(path);
                ABTarget target   = GetOrCreateTarget(context, fileInfo);
                if (target == null)
                {
                    return;
                }

                AddDepend(target);
                target.Analyze();
            });
        }