---
title: CreateForCodeLoad(Action, string)
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/unityengine/delegateautocleanup/createforcodeload
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/delegateautocleanup/createforcodeload.md
last_updated: 2026-10-29
generated_at: 2026-11-04T01:22:39.429Z
locale: en-us
---

# CreateForCodeLoad(Action, string)

> Method used by code generators to create a cleanup entry that runs when scripts are reloaded. Don't attempt to use this directly.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/7000.0/script-reference/unityengine.md)
* **Assembly:** Unity.Scripting

```csharp
public static DelegateAutoCleanup CreateForCodeLoad(Action cleanup, string ownerDescription = "")
```

### Parameters

**** (\[Action]\(https\://learn.microsoft.com/dotnet/api/system.action)): **** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)):&#x20;

### Returns

| Type                                                                                      | Description |
| ----------------------------------------------------------------------------------------- | ----------- |
| [DelegateAutoCleanup](/engine/7000.0/script-reference/unityengine/delegateautocleanup.md) |             |
