How to use Unity / C# features

  1. You must have this type of component before you can use this script. When adding this script, add a component of this type intelligently
[RequireComponent(typeof(MeshFilter))]
  1. Add a comment to the first public variable below in front of the details pane
[Header("备注")]
  1. Hide the next variable from being shown in the details pane
[HideInInspector]
public float num;
  1. Add menu bar
    [MenuItem("菜单栏/菜单A")]
    public static void MenuA()
    {
    
    

    }

    [MenuItem("菜单栏/菜单B")]
    public static void MenuB()
    {
    
    

    }

    [MenuItem("菜单栏/菜单A/菜单A_1")]
    public static void MenuA_1()
    {
    
    

    }

Then you can find the following menu in the menu bar in the upper left corner of the unity engine, and after clicking, the function below the corresponding menu will be called
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44081533/article/details/113341006