- Home /
Arranging items in the @ContextMenu?
How does one arrange items in a context menu so that they're in a logical order? I have the following (pseudo)-code
@ContextMenu("Save 1st Position") function SavePositionA()
@ContextMenu("Save 2nd Position") function SavePositionB()
@ContextMenu("Clear Saved Positions") function ClearSavedPositions()
@ContextMenu("Assume 1st Position") function AssumePositionA()
@ContextMenu("Assume 2nd Position") function AssumePositionB()
I would have expected that to have been the order of the context menus. However, the order I get is
- Assume 2nd Position
- Clear Saved Positions
- Save 1st Position
- Save 2nd Position
- Assume 1st Position
From playing around with it, it seems they appear in alphabetical order, except that the last function always appears first? Or something...? Which seems a little random. Am I doing something wrong? 3.
Answer by yoyo · Feb 10, 2011 at 04:48 PM
Unfortunately there is no way to control the order. The ContextMenu attribute does not have validation and ordering options like MenuItem. Time for a feature request?
Your answer
![](https://koobas.hobune.stream/wayback/20220613103658im_/https://answers.unity.com/themes/thub/images/avi.jpg)