Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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,533
    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,533
    Glad I could help!