Description:
For example, when I was using the MenuItem feature of Unity, I reported an error "The feature argument must be a constant expression, typeof expression, or array creation expression of the feature parameter type"
After several positioning, the reason is because my string is not defined with const. For characteristics, the actual parameter must be a constant value, and what I define is a variable; in addition, there is no readonly declaration. Used, the reasons can be seen: C# knowledge series: the difference between readonly and const
public static string CustomEidorMenu = "CustomEidorMenu";
public static readonly string CustomEidorMenu = "CustomEidorMenu";
After testing, the following line of code does not work. In C#, only "+" string concatenation string constants can be determined during compilation, and the others are dynamic concatenation.
[MenuItem($"{EditorConfig.CustomEidorMenu}/window")]
So the solution is as follows, compiled through
public const string CustomEidorMenu = "CustomEidorMenu";
[MenuItem(EditorConfig.CustomEidorMenu + "/window")]