Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

ReplacementComponentAttribute Constructor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public ReplacementComponentAttribute(string typeName, string displayName);

Parameters

Parameter Description
typeName The full type name of the replacement component including its namespace.
displayName Optional display name to display in the Inspector button. If it's not specified, Unity derives a name from typeName.

Description

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

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.

using UnityEngine;

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

}