Skip to content

format

typescript
Directory.Exists(path)

class: Directory

description

Check if the specified directory exists.

parameter

param_nametypedescription
pathstringThe specified directory.

return

typedescription
booleanWhether the directory exists.

code example

typescript
// Create a directory
Directory.Create("Assets/newPath");
// Check if the current directory exists
let result = Directory.Exists("Assets/newPath");
if (result) {
    Debug.Log("The current directory exists");
} else {
    Debug.Log("The current directory does not exist");
}