Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Guide to the Godot game engine/Plugins/Creating resources

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Plugins/Making your first plugin Plugins/Importers Making your first plugin Importers To make a new resource Resource, you need to make a new script (that is not attached to a node). Here is an example: tool extends Resource export (int, INT, STRING) var property_type = 0 setget set_type var property func _get_property_list(): var out = [ { "name": "Property", "type": [TYPE_INT, TYPE_STRING][property_type] } ] return out func _get(what): if what == "Property": return property func _set(what, to): if what == "Property": what = to func set_type(value): property_type = value match value: 0: if !property is int: property = int(property) 1: if !property is String: property = String(property) A simple example that shows a resource that can store either an int or a String. The _get_property_list() must return an Array of Dictionarys, each with the following values: name (String): the property's name. type (int): A constant that begins with TYPE_*. The following are optional: hint (int): PROPERTY_HINT_* constants. hint_string (String) usage (int): PROPERTY_USAGE_* constants. property_type is too simple to need to be changed or defined with _get_property_list(). Instead, export is used, along with setget to process when it is changed. When property_type is set, the type of property is changed. Real-world examples include storing keys or images. A resource just holds data for other scripts, it doesn't actually process it itself. <noinclude>Plugins/Making your first plugin Plugins/Importers