示例#1
0
        private static void ApplyFilter(Dictionary <string, FR2_Ref> refs, FR2_Asset asset)
        {
            string targetPath = AssetDatabase.GUIDToAssetPath(asset.guid);

            if (string.IsNullOrEmpty(targetPath))
            {
                return;                 // asset not found - might be deleted!
            }

            //asset being moved!
            if (targetPath != asset.assetPath)
            {
                asset.LoadAssetInfo();
            }

            Object target = AssetDatabase.LoadAssetAtPath(targetPath, typeof(Object));

            if (target == null)
            {
                Debug.LogWarning("target is null");
                return;
            }

            bool targetIsGameobject = target is GameObject;

            if (targetIsGameobject)
            {
                foreach (GameObject item in FR2_Unity.getAllObjsInCurScene())
                {
                    if (FR2_Unity.CheckIsPrefab(item))
                    {
                        string itemGUID = FR2_Unity.GetPrefabParent(item);
                        // Debug.Log(item.name + " itemGUID: " + itemGUID);
                        // Debug.Log(target.name + " asset.guid: " + asset.guid);
                        if (itemGUID == asset.guid)
                        {
                            Add(refs, item, 1);
                        }
                    }
                }
            }

            string dir = Path.GetDirectoryName(targetPath);

            if (FR2_SceneCache.Api.folderCache.ContainsKey(dir))
            {
                foreach (Component item in FR2_SceneCache.Api.folderCache[dir])
                {
                    if (FR2_SceneCache.Api.cache.ContainsKey(item))
                    {
                        foreach (FR2_SceneCache.HashValue item1 in FR2_SceneCache.Api.cache[item])
                        {
                            if (targetPath == AssetDatabase.GetAssetPath(item1.target))
                            {
                                Add(refs, item, 1);
                            }
                        }
                    }
                }
            }
        }