User Tools

Site Tools


This is an old revision of the document!


Type annotations

Single-property type

A type with this annotation contains only a single serialized property. Thus, to make the syntax lighter, instantiation for this type can be done by simply providing the value of the single property.

	ResourceNeededList = { -- list of RESOURCE_COLLECTION_VALUE
		-- Can be serialized in full, like any other type
			Collection = {
				{ Resource = "WOOD", Quantity = 20 },
				{ Resource = "STONE", Quantity = 10 },
		-- Or serialized directly like its only property, a list of RESOURCE_QUANTITY_PAIR
			{ Resource = "WOOD", Quantity = 20 },
			{ Resource = "STONE", Quantity = 10 },


By default, components are always initialized (call of init function) right after being created. For components flagged as lazy-init though, if the component is disabled on creation, the initialization is delayed until the component is enabled for the first time.

local standardComp = nil
local lazyInitComp = nil
    standardComp = _newObject:addComponent("STANDARD_COMPONENT")
    lazyInitComp = _newObject:addComponent("LAZY_INIT_COMPONENT")
-- at the end of createObject, only standardComp is initialized because it is disabled, but not lazy-init
-- when enabling lazyInitComp, since it's enabled for the first time, it is initialized at the same time

Property annotations


This property is used to configure the data of assets or prefab components. For components and their data, it is saved in the savegame file, unless the component is owned by an object instantiated by a prefab, in which case it also needs to be tagged as Savegame to be saved.


The value of this property is always saved in the savegame file.

Runtime only

This property is not used to configure an asset/component/data, but can be read and set at runtime.

annotations.1639154018.txt.gz · Last modified: 2021/12/10 11:33 by maxime