Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

ResourceSaver

Inherits: Object

A singleton for saving Resources to the filesystem.

Description

A singleton for saving resource types to the filesystem.

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

Methods

void

add_resource_format_saver ( ResourceFormatSaver format_saver, bool at_front=false )

PackedStringArray

get_recognized_extensions ( Resource type )

void

remove_resource_format_saver ( ResourceFormatSaver format_saver )

Error

save ( Resource resource, String path="", BitField<SaverFlags> flags=0 )


Enumerations

flags SaverFlags:

SaverFlags FLAG_NONE = 0

No resource saving option.

SaverFlags FLAG_RELATIVE_PATHS = 1

Save the resource with a path relative to the scene which uses it.

SaverFlags FLAG_BUNDLE_RESOURCES = 2

Bundles external resources.

SaverFlags FLAG_CHANGE_PATH = 4

Changes the Resource.resource_path of the saved resource to match its new location.

SaverFlags FLAG_OMIT_EDITOR_PROPERTIES = 8

Do not save editor-specific metadata (identified by their __editor prefix).

SaverFlags FLAG_SAVE_BIG_ENDIAN = 16

Save as big endian (see FileAccess.big_endian).