Singleton for saving Godot-specific resource types.
    public static class ResourceSaver

Singleton for saving Godot-specific resource types to the filesystem.

It uses the many ResourceFormatSaver classes registered in the engine (either built-in or from a plugin) to save engine-specific resource data to text-based (e.g. .tres or .tscn) or binary files (e.g. .res or .scn).

Inheritance Chain

Static Properties

    public static Object Singleton { get; }

Static Methods

    public static string[] GetRecognizedExtensions(Resource type)

Returns the list of extensions available for saving a resource of a given type.

    public static Error Save(string path, Resource resource, SaverFlags flags = (SaverFlags)0)

Saves a resource to disk to the given path, using a ResourceFormatSaver that recognizes the resource object.

The flags bitmask can be specified to customize the save behavior.

Returns [constant OK] on success.

Inner Types


Name Value Description
RelativePaths 1 Save the resource with a path relative to the scene which uses it.
BundleResources 2 Bundles external resources.
ChangePath 4 Changes the [member Resource.resource_path] of the saved resource to match its new location.
OmitEditorProperties 8 Do not save editor-specific metadata (identified by their [code]__editor[/code] prefix).
SaveBigEndian 16 Save as big endian (see [member File.endian_swap]).
Compress 32 Compress the resource on save using [constant File.COMPRESSION_ZSTD]. Only available for binary resource types.
ReplaceSubresourcePaths 64 Take over the paths of the saved subresources (see [method Resource.take_over_path]).