ResourceFormatSaver

Inherits: Reference < Object

Inherited By: GDNativeLibraryResourceSaver, ResourceFormatSaverBinary, ResourceFormatSaverGDScript, ResourceFormatSaverNativeScript, ResourceFormatSaverShader, ResourceFormatSaverText, ResourceSaverPNG

Category: Core

Brief Description

Saves a specific resource type to a file.

Methods

PoolStringArray get_recognized_extensions ( Resource resource ) virtual
bool recognize ( Resource resource ) virtual
int save ( String path, Resource resource, int flags ) virtual

Description

The engine can save resources when you do it from the editor, or when you call ResourceSaver.save. This is accomplished with multiple ResourceFormatSavers, each handling its own format.

By default, Godot saves resources as .tres, .res or another built-in format, but you can choose to create your own format by extending this class. You should give it a global class name with class_name for it to be registered. You may as well implement a ResourceFormatLoader.

Method Descriptions

Gets the list of extensions for files this saver is able to write.

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

Saves the given resource object to a file. flags is a bitmask composed with FLAG_* constants defined in ResourceSaver. Returns OK on success, or an ERR_* constant listed in @GlobalScope if it failed.