---
title: Unity.Scripting
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/modules/unity-scripting
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/modules/unity-scripting.md
last_updated: 2026-11-30
generated_at: 2026-11-30T20:29:31.766Z
locale: en-us
---

# 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.

## Definition

* **Type:** Module

## Classes

| Class                                                                                                                                             | Description                                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AlwaysLinkAssemblyAttribute](/engine/7000.0/script-reference/unityengine/scripting/alwayslinkassemblyattribute.md)                               | Ensure an assembly is always processed during managed code stripping.                                                                                                                                                                                                                                   |
| [AutoStaticsCleanupAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/autostaticscleanupattribute.md)                 | Resets static variables automatically on entering or exiting Play mode with code reload disabled.                                                                                                                                                                                                       |
| [ClassAutoCleanup](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/codegen/classautocleanup.md)                               | This class supports code generation for the [AutoStaticsCleanupAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/autostaticscleanupattribute.md) and is public to allow the code generator to subclass it in Unity project code. Don't attempt to use this class directly. |
| [ClearCacheBetweenCodeLoadsAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/clearcachebetweencodeloadsattribute.md) | Marks a static method as a callback that clears cached data between code loads.                                                                                                                                                                                                                         |
| [DelegateAutoCleanup](/engine/7000.0/script-reference/unityengine/delegateautocleanup.md)                                                         | Class 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.                                                                                                                                    |
| [LifecycleAttributeBase](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/lifecycleattributebase.md)                           | Base class for lifecycle callback attributes.                                                                                                                                                                                                                                                           |
| [LifecycleMethodRegistration](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/codegen/lifecyclemethodregistration.md)         | Infrastructure class used by generated code to register lifecycle callback methods. Not intended for direct use.                                                                                                                                                                                        |
| [NoAutoStaticsCleanupAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/noautostaticscleanupattribute.md)             | Prevents static variables from being automatically reset on entering or exiting Play mode with code reload disabled.                                                                                                                                                                                    |
| [OnAssemblyLoadedAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/onassemblyloadedattribute.md)                     | Marks a static method as a callback that Unity invokes after Unity loads each assembly.                                                                                                                                                                                                                 |
| [OnAssemblyUnloadingAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/onassemblyunloadingattribute.md)               | Marks a static method as a callback that Unity invokes before unloading each assembly.                                                                                                                                                                                                                  |
| [OnCodeDeinitializingAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/oncodedeinitializingattribute.md)             | Marks a static method as a callback to be invoked before managed objects are backed up for a code reload.                                                                                                                                                                                               |
| [OnCodeInitializingAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/oncodeinitializingattribute.md)                 | Marks a static method as a callback to be invoked after managed objects have been restored following a code reload.                                                                                                                                                                                     |
| [OnCodeLoadedAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/oncodeloadedattribute.md)                             | Marks a static method as a callback that Unity invokes after it loads code at startup or after a code reload.                                                                                                                                                                                           |
| [OnCodeUnloadingAttribute](/engine/7000.0/script-reference/unity/scripting/lifecyclemanagement/oncodeunloadingattribute.md)                       | Marks a static method as a callback to be invoked before code is unloaded during a code reload.                                                                                                                                                                                                         |
| [OnEnteringPlayModeAttribute](/engine/7000.0/script-reference/unityengine/onenteringplaymodeattribute.md)                                         | Marks a static method as a callback to be invoked when entering Play mode.                                                                                                                                                                                                                              |
| [OnExitingPlayModeAttribute](/engine/7000.0/script-reference/unityengine/onexitingplaymodeattribute.md)                                           | Marks a static method as a callback to be invoked when exiting Play mode.                                                                                                                                                                                                                               |
| [RequireAttributeUsagesAttribute](/engine/7000.0/script-reference/unityengine/scripting/requireattributeusagesattribute.md)                       | Only allowed on attribute types. If the attribute type is marked, then so too will all CustomAttributes of that type.                                                                                                                                                                                   |
| [RequiredByAssemblyAttribute](/engine/7000.0/script-reference/unity/scripting/requiredbyassemblyattribute.md)                                     | When an assembly is marked, all types and members with \[RequiredByAssembly] are marked.                                                                                                                                                                                                                |
| [RequireDerivedAttribute](/engine/7000.0/script-reference/unityengine/scripting/requirederivedattribute.md)                                       | When the type is marked, all types derived from that type will also be marked.                                                                                                                                                                                                                          |
| [RequiredInterfaceAttribute](/engine/7000.0/script-reference/unityengine/scripting/requiredinterfaceattribute.md)                                 | When a type is marked, all interface implementations of the specified types will be marked.                                                                                                                                                                                                             |
| [RequiredMemberAttribute](/engine/7000.0/script-reference/unityengine/scripting/requiredmemberattribute.md)                                       | When a type is marked, all of its members with \[RequiredMember] are marked.                                                                                                                                                                                                                            |
| [RequireImplementorsAttribute](/engine/7000.0/script-reference/unityengine/scripting/requireimplementorsattribute.md)                             | When the interface type is marked, all types implementing that interface will be marked.                                                                                                                                                                                                                |
| [StubBodyIfTypeNotInstantiatedAttribute](/engine/7000.0/script-reference/unityengine/scripting/stubbodyiftypenotinstantiatedattribute.md)         | This 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.                                                                                                           |
