See all glossary terms

Lifecycle (term)

In OOP parlance, the term "lifecycle" refers to the logic governing creation, lifetime, and destruction of an object.
For example, when opening a file, GDScript needs to:
  • Get a handle to the file
  • Read the file and store the results somewhere in memory
  • Close the file
  • Release the memory
Often, in GDScript, we talk of "lifecycle" when discussing the order in which functions are called during the node lifecycle. For example, when a node is added to the scene tree, the _enter_tree() function is called. When the node is removed from the scene tree, the _exit_tree() function is called. Other objects rarely have a lifecycle per se, even if all objects have at least the _init() function.

See Also

Related terms in the Glossary