Documentation

Unity Engine

Download Unity

Unity Engine

LifecycleAttributeBase

Base class for lifecycle callback attributes.
Read time 4 minutesLast updated 14 days ago

Definition

public abstract class LifecycleAttributeBase : RequiredMemberAttribute

Remarks

This is the abstract base class for all lifecycle callback attributes. Do not inherit from this class directly; use the specific lifecycle attributes instead:
Lifecycle Timing:
Code reload order (Editor only):
  1. OnCodeDeinitializingAttribute - Objects serialized.
  2. OnCodeUnloadingAttribute - Code about to unload.
  3. OnAssemblyUnloadingAttribute - Each assembly about to unload, in reverse dependency order.
  4. (Code unloads and reloads)
  5. OnAssemblyLoadedAttribute - Each assembly loaded, in dependency order.
  6. OnCodeLoadedAttribute - Code loaded.
  7. OnCodeInitializingAttribute - Objects deserialized.
Initial code load (Editor and Player):
  1. OnAssemblyLoadedAttribute - Each assembly loaded, in dependency order.
  2. OnCodeLoadedAttribute - Code loaded.
  3. OnCodeInitializingAttribute - Called before initial scene loads.
Shutdown (Editor and Player):
  1. OnCodeUnloadingAttribute - Code about to unload.
  2. OnAssemblyUnloadingAttribute - Each assembly about to unload, in reverse dependency order.

Inheritance

Inherited Members