Search Unity

Extending the 'Project View'

Discussion in 'Immediate Mode GUI (IMGUI)' started by starface606, Sep 5, 2014.

  1. starface606

    starface606

    Joined:
    Sep 5, 2014
    Posts:
    7
    Hello there!
    I'm new to the community and need your help right away:) is there a method to extend the Project View?
    I would like to add something to the Project-Create-xxx list:D

    I'm also new into Editor Extensions, so please consider me knowing NOTHING of Editor Scripting:O
    Thanks for any help!
    Starface606
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Use the [MenuItem()] attribute with "Assets/" at the front of the string:

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. public static class MyMenuItems {
    5.  
    6.     [MenuItem("Assets/Create/My Asset Type", false, 0)]
    7.     public static void CreateMyAssetType() {
    8.         //Create your asset here.
    9.     }
    10. }
     
    starface606 likes this.
  3. starface606

    starface606

    Joined:
    Sep 5, 2014
    Posts:
    7
    thanks, i will try;)

    update: works exactly as i want it to, awesome! thank you again:)
     
    Last edited: Sep 11, 2014
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Glad I could help!