Documentation

Unity Engine

Download Unity

Unity Engine

Unity.Scripting

Contains the attributes that control how scripting code and static state are loaded, unloaded, and reset across code reloads and Play mode transitions.
Read time 2 minutesLast updated 3 hours ago

Definition

  • Type: Module

Classes

Class

Description

AlwaysLinkAssemblyAttributeEnsure an assembly is always processed during managed code stripping.
AutoStaticsCleanupAttributeResets static variables automatically on entering or exiting Play mode with code reload disabled.
ClassAutoCleanupThis class supports code generation for the AutoStaticsCleanupAttribute and is public to allow the code generator to subclass it in Unity project code. Don't attempt to use this class directly.
ClearCacheBetweenCodeLoadsAttributeMarks a static method as a callback that clears cached data between code loads.
DelegateAutoCleanupClass used by the source generator to reset static variables when entering or exiting Play mode with code reload disabled. Don't attempt to use this class directly.
LifecycleAttributeBaseBase class for lifecycle callback attributes.
LifecycleMethodRegistrationInfrastructure class used by generated code to register lifecycle callback methods. Not intended for direct use.
NoAutoStaticsCleanupAttributePrevents static variables from being automatically reset on entering or exiting Play mode with code reload disabled.
OnAssemblyLoadedAttributeMarks a static method as a callback that Unity invokes after Unity loads each assembly.
OnAssemblyUnloadingAttributeMarks a static method as a callback that Unity invokes before unloading each assembly.
OnCodeDeinitializingAttributeMarks a static method as a callback to be invoked before managed objects are backed up for a code reload.
OnCodeInitializingAttributeMarks a static method as a callback to be invoked after managed objects have been restored following a code reload.
OnCodeLoadedAttributeMarks a static method as a callback that Unity invokes after it loads code at startup or after a code reload.
OnCodeUnloadingAttributeMarks a static method as a callback to be invoked before code is unloaded during a code reload.
OnEnteringPlayModeAttributeMarks a static method as a callback to be invoked when entering Play mode.
OnExitingPlayModeAttributeMarks a static method as a callback to be invoked when exiting Play mode.
RequireAttributeUsagesAttributeOnly allowed on attribute types. If the attribute type is marked, then so too will all CustomAttributes of that type.
RequiredByAssemblyAttributeWhen an assembly is marked, all types and members with [RequiredByAssembly] are marked.
RequireDerivedAttributeWhen the type is marked, all types derived from that type will also be marked.
RequiredInterfaceAttributeWhen a type is marked, all interface implementations of the specified types will be marked.
RequiredMemberAttributeWhen a type is marked, all of its members with [RequiredMember] are marked.
RequireImplementorsAttributeWhen the interface type is marked, all types implementing that interface will be marked.
StubBodyIfTypeNotInstantiatedAttributeThis attribute supports code generation for Managed Serialization and is public to allow the code generator to access it in Unity project code. Don't attempt to use this attribute directly.