# ReplacementComponentAttribute(string, string)

> Initializes the attribute with the replacement type name and an optional display name.

## Definition

* **Type:** Constructor
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public ReplacementComponentAttribute(string typeName, string displayName = null)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The full type name of the replacement component including its namespace.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional display name to display in the Inspector button. If it's not specified, Unity derives a name from `typeName`.

### Remarks

When you annotate a deprecated component with this attribute, Unity displays a button on the component’s UI in the Inspector window. When you click this button, Unity adds an instance of the replacement component to the same GameObject.

### Examples

```csharp
using UnityEngine;

[System.ObsoleteAttribute("The ObsoleteMonoBehaviour component is deprecated.", false)]
[ReplacementComponent("UnityEngine.Camera", "Example Component")]
public class ObsoleteMonoBehaviour : MonoBehaviour
{

}
```
