Version: 2023.2
언어: 한국어
public static string[] GetSubFolders (string path);

설명

Given a path to a directory in the Assets folder, relative to the project folder, this method will return an array of all its subdirectories.

using UnityEditor;
using UnityEngine;

public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/Get Folder List")] static void SubFolderExample() { //This method prints out the entire folder list of a project into the console var folders = AssetDatabase.GetSubFolders("Assets"); foreach (var folder in folders) { Recursive(folder); } }

static void Recursive(string folder) { Debug.Log(folder); var folders = AssetDatabase.GetSubFolders(folder); foreach (var fld in folders) { Recursive(fld); } } }