AddComponentMenu
The AddComponentMenu attribute allows you to place a script anywhere in the "Component" menu, instead of just the "Component-\>Scripts" menu.
Read time 3 minutesLast updated 4 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
- Inherits from: Attribute
public sealed class AddComponentMenu : Attribute
Remarks
You can use this to organize the Component menu better and improve the workflow of adding scripts.
Examples
using UnityEngine;[AddComponentMenu("Transform/Follow Transform")]public class FollowTransform : MonoBehaviour{}
Constructors
Constructor | Description |
|---|---|
| AddComponentMenu(System.String) | Add an item in the Component menu. |
| AddComponentMenu(System.String,System.Int32) | Add an item in the Component menu. |
Properties
Property | Description |
|---|---|
| componentOrder | The order of the component in the component menu (lower values appear higher in the menu). |