Attributes#

Attributes are similar to properties but are dynamic, i.e., they are not specified by the class and can change type. Like properties, values are restricted to the types in Attribute. Classes with attributes save/load their attributes from YAML.

type Attribute = bool | int | float | str | Vector2 | list[bool] | list[int] | list[float] | list[str] | list[Vector2]

This class defines set and get methods to access dynamic attributes

Remove all attributes

Gets the value of the specified attribute.

Parameters:

name – The name of the attribute

Returns:

The value of the attribute

Checks if the specified attribute is set.

Parameters:

name – The name of the attribute

Returns:

True if the attribute is present.

Set the value of a named attribute.

Parameters:
  • name – The name of the property

  • value – The desired value for the attribute

Type:

dict[str, Union[bool, int, float, str, Vector2, list[bool], list[int], list[float], list[str], list[Vector2]]]

All attributes.