コード例 #1
0
        private string[] GetAllAssetPaths(string[] searchLocation)
        {
            /*
             * Note: This will count both directories and script files as assets
             */
            string[] assets = AssetDatabase.FindAssets("t:Object", searchLocation);

            Debug.Log($"Found {assets.Length} assets.");

            SelectedPrefabsBook excludedPrefabs = _excludedPrefabsField == null ? null : _excludedPrefabsField.value as SelectedPrefabsBook;

            string[] excludedPaths = null;

            if (excludedPrefabs != null)
            {
                excludedPaths = excludedPrefabs.SelectedPrefabs
                                .Where(o => o != null)
                                .Select(go => AssetDatabase.GetAssetPath(go))
                                .ToArray();
            }

            string[] paths = assets
                             .Select(asset => AssetDatabase.GUIDToAssetPath(asset))
                             .Where(path => !IsExcludedPath(excludedPaths, path))
                             .ToArray();

            return(paths);
        }
コード例 #2
0
        private string[] GetSelectedAssetPaths()
        {
            SelectedPrefabsBook prefabsBook = _selectedPrefabsField.value as SelectedPrefabsBook;

            string[] paths = prefabsBook.SelectedPrefabs.Select(o => AssetDatabase.GetAssetPath(o)).ToArray();

            return(paths);
        }