I want to create an extension for the Unity 3D Editor and have an custom asset type. During the process of creation this I recognized that I would improve the UX/usability if I can specify the path where I want to create the asset by using right click. But I fail to get the context path of the right click and I cannot find any hints on google or at the unity scripting api. Below you can see an image of the process I tried to describe above.
Here is the code that is responsible for handling the context creation "event".
[MenuItem("Assets/Create/Chat")]
public static void createChatViaMenu() {
Chat c = Chatter.createDefaultChat();
// This is the part where I want to insert the relative path.
AssetDatabase.CreateAsset(c, "Assets/" + c.Title + ".asset");
}
If you need any more information please let me know.