Version: 2023.1
언어: 한국어
public int componentOrder ;

설명

The order of the component in the component menu (lower is higher to the top).

Note: The order only affects the component item itself and doesn't influence any submenus.

Scripts are first sorted by their namespace. Scripts without a namespace are positioned after those with a namespace.

By default, menu items are assigned a position value of 20. The 'componentOrder' value is then added to this default position to determine the final placement of the item. The order is not limited and can be a negative value.

If your item has a priority of 11 or higher than the previous item, Unity will automatically insert a separator before your item in the menu.

The following example shows how MyScript2 can be brought above MyScript by using a componentOrder of -1:

using UnityEngine;

[AddComponentMenu("My Scripts/My Script 1")] public class MyScript1 : MonoBehaviour { }

[AddComponentMenu("My Scripts/My Script 2", -1)] public class MyScript2 : MonoBehaviour { }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961