ReplacementComponentAttribute(string, string)
Initializes the attribute with the replacement type name and an optional display name.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Constructor
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public ReplacementComponentAttribute(string typeName, string displayName = null)
Parameters
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
using UnityEngine;[System.ObsoleteAttribute("The ObsoleteMonoBehaviour component is deprecated.", false)][ReplacementComponent("UnityEngine.Camera", "Example Component")]public class ObsoleteMonoBehaviour : MonoBehaviour{}