# SetTransformParent

> Sets the parent of transform to the new parent and records an undo operation.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

## SetTransformParent(Transform, Transform, string)

Sets the parent of transform to the new parent and records an undo operation.

```csharp
public static void SetTransformParent(Transform transform, Transform newParent, string name)
```

### Parameters

**** (\[Transform]\(/engine/6000.0/script-reference/unityengine/transform)): The Transform component whose parent is to be changed.**** (\[Transform]\(/engine/6000.0/script-reference/unityengine/transform)): The parent Transform to be assigned.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of this action, to be stored in the Undo history buffer.

### Remarks

This is equivalent to calling transform.parent = newParent, but it additionally records the undo operation.

## SetTransformParent(Transform, Transform, bool, string)

Sets the parent of transform to the new parent and records an undo operation.

```csharp
public static void SetTransformParent(Transform transform, Transform newParent, bool worldPositionStays, string name)
```

### Parameters

**** (\[Transform]\(/engine/6000.0/script-reference/unityengine/transform)): The Transform component whose parent is to be changed.**** (\[Transform]\(/engine/6000.0/script-reference/unityengine/transform)): The parent Transform to be assigned.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): **** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of this action, to be stored in the Undo history buffer.

### Remarks

This is equivalent to calling transform.parent = newParent, but it additionally records the undo operation.
