EditorFileSystem
Resource filesystem, as the editor sees it.
Resource filesystem, as the editor sees it.
This object holds information of all resources in the filesystem, their types, etc.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using EditorInterface.GetResourceFilesystem.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Methods11
GetFileTypestring
public string GetFileType(string path);Returns the resource type of the file, given the full path. This returns a string such as "Resource" or "C#", not a file extension such as ".cs".
| Name | Type | Default |
|---|---|---|
path | string | — |
stringGetFilesystemEditorFileSystemDirectory
public EditorFileSystemDirectory GetFilesystem();Gets the root directory object.
EditorFileSystemDirectoryGetFilesystemPathEditorFileSystemDirectory
public EditorFileSystemDirectory GetFilesystemPath(string path);Returns a view into the filesystem at path.
| Name | Type | Default |
|---|---|---|
path | string | — |
EditorFileSystemDirectoryGetScanningProgressfloat
public float GetScanningProgress();Returns the scan progress for 0 to 1 if the FS is being scanned.
floatIsImportingbool
public bool IsImporting();Returns true if resources are currently being imported.
boolIsScanningbool
public bool IsScanning();Returns true if the filesystem is being scanned.
boolReimportFiles2 overloads
public void ReimportFiles(ReadOnlySpan<string> files);Reimports a set of files. Call this if these files or their .import files were directly edited by script or an external program.
If the file type changed or the file was newly created, use EditorFileSystem.UpdateFile or EditorFileSystem.Scan.
Note: This function blocks until the import is finished. However, the main loop iteration, including timers and Entity._Process, will occur during the import process due to progress bar updates. Avoid calls to EditorFileSystem.ReimportFiles or EditorFileSystem.Scan while an import is in progress.
| Name | Type | Default |
|---|---|---|
files | ReadOnlySpan<string> | — |
public void ReimportFiles(string[] files);Reimports a set of files. Call this if these files or their .import files were directly edited by script or an external program.
If the file type changed or the file was newly created, use EditorFileSystem.UpdateFile or EditorFileSystem.Scan.
Note: This function blocks until the import is finished. However, the main loop iteration, including timers and Entity._Process, will occur during the import process due to progress bar updates. Avoid calls to EditorFileSystem.ReimportFiles or EditorFileSystem.Scan while an import is in progress.
| Name | Type | Default |
|---|---|---|
files | string[] | — |
Scanvoid
public void Scan();Scan the filesystem for changes.
ScanSourcesvoid
public void ScanSources();Check if the source of any imported resource changed.
UpdateFilevoid
public void UpdateFile(string path);Add a file in an existing directory, or schedule file information to be updated on editor restart. Can be used to update text files saved by an external program.
This will not import the file. To reimport, call EditorFileSystem.ReimportFiles or EditorFileSystem.Scan methods.
| Name | Type | Default |
|---|---|---|
path | string | — |
Signals and events6
FilesystemChangedEvent
public event Action FilesystemChanged;Emitted if the filesystem changed.
ResourcesReimportedEvent
public event EditorFileSystem.ResourcesReimportedEventHandler ResourcesReimported;Emitted if a resource is reimported.
| Name | Type | Default |
|---|---|---|
resources | string[] | — |
ResourcesReimportingEvent
public event EditorFileSystem.ResourcesReimportingEventHandler ResourcesReimporting;Emitted before a resource is reimported.
| Name | Type | Default |
|---|---|---|
resources | string[] | — |
ResourcesReloadEvent
public event EditorFileSystem.ResourcesReloadEventHandler ResourcesReload;Emitted if at least one resource is reloaded when the filesystem is scanned.
| Name | Type | Default |
|---|---|---|
resources | string[] | — |
ScriptClassesUpdatedEvent
public event Action ScriptClassesUpdated;Emitted when the list of global script classes gets updated.
SourcesChangedEvent
public event EditorFileSystem.SourcesChangedEventHandler SourcesChanged;Emitted if the source of any imported file changed.
| Name | Type | Default |
|---|---|---|
exist | bool | — |