Order for CreateAssetMenu folder structure

Hello,
I am working on a ScriptableObject and I am stuck (with a quality of life feature).
I am trying to Create an Asset Menu for my Object that is below (at least) the folder button.

[System.Serializable]
[CreateAssetMenu(fileName = "Translation", menuName = "Translation", order = 11)]
public class Translation : ScriptableObject {
//...
}

This works. It shows the Translation Button below the folder button in the Create Submenu.

[System.Serializable]
[CreateAssetMenu(fileName = "Translation", menuName = "Tools/Translation", order = 11)]
public class Translation : ScriptableObject {
//...
}

This however does not work. It shows the Tools Menu above everything.

How can I set the Tools menu buttons order? Is that even possible?

Version: 2017-1
Thanks for helping

It is also happening to me. Version 2017.3 right now.

3 Answers

3

It appears that it is impossible to set the priority of the menu foldout directly. If there is a way to do it, it’s certainly not documented. I even looked at the Unity code repo…couldn’t find anything!

However, the foldout seems to inherit the priority from the items put inside. Thus, if you have a specific location in mind, you should just be able to set all of your order values to be the same (This guide, linked below, might help with picking the right value). You might just need to restart Unity if you’re having issues getting this to work; it can be slow to update.

For me, this wouldn’t work because I wanted to have my options organized in a specific way.

I was able to work around the limitation by giving all of the items very extreme values. If you want your foldout to be at the end of the list, use really big values (greater than 1000). If you would rather put your items at the start of the list, use negative values. This way, you can have a wide range of priorities without having your foldout shuffle around randomly.

I've just tried, and it is true: you cannot specify the priority of a folder directly, it depends on the priority of the menu items in it. The linked article has a more specific description, but basically if you want to put and extensive menu at the top of the Create context menu, negative numbers are probably the way to go (which do work), because the "Folder" menu item has a priority of 11.

It is also happening to me. Version 2017-3 right now.

The gear icon is on the right hand side of the title of any answer in Unity forums. It is visible when logged in and clicking it shows a menu. If you click it and only see a "Report" option, then it means that I made a mistake (and the revision history is only visible to me). In that case, I will update my answer and will remove the sentence about the old answer.

Hi there!

I’m not sure this issue is because of the Unity version or not, but the answer to this stackoverflow question helped me sort my asset menu folders and gave a lot of insight how the menu items work:

Additionally, if you want your folder to appear before the other Unity menu items, give it a big negative number, like -1000. I read a post once about the sort orders of the default Unity folders, and their sort orders are somewhere in the range of -100 to +100.