ResourceFormatSaver

Inherits: Reference < Object

Inherited By: ResourceFormatSaverCrypto

Saves a specific resource type to a file.

Description

The engine can save resources when you do it from the editor, or when you use the ResourceSaver singleton. This is accomplished thanks to multiple ResourceFormatSavers, each handling its own format and called automatically by the engine.

By default, Godot saves resources as .tres (text-based), .res (binary) or another built-in format, but you can choose to create your own format by extending this class. Be sure to respect the documented return types and values. You should give it a global class name with class_name for it to be registered. Like built-in ResourceFormatSavers, it will be called automatically when saving resources of its recognized type(s). You may also implement a ResourceFormatLoader.

Methods

PoolStringArrayget_recognized_extensions ( Resource resource ) virtual
boolrecognize ( Resource resource ) virtual
intsave ( String path, Resource resource, int flags ) virtual

Method Descriptions

Returns the list of extensions available for saving the resource object, provided it is recognized (see recognize).


Returns whether the given resource object can be saved by this saver.


Saves the given resource object to a file at the target path. flags is a bitmask composed with SaverFlags constants.

Returns @GlobalScope.OK on success, or an Error constant in case of failure.

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.