Create Predefined Script from Menu

Hi There.

When I create a new script, I click “Assets->create->c# Script” for example, then the new script is added.
Is there a way to extend this create-menu for custom scripts/items??
Let’s pretend there is a custom script derived from MonoBehaviour, called MyMonoBehaviour.
Is there a way to create a new script derived from MyMonoBehaviour by the create-menu??
How can I extend this menu to do so?

To clearify, I mean this menu:
create menu

Thanks for any help.
Greets.

seems clear that you are looking for this..... this is an editor script. all editor scripts should be kept inside a folder called Editor and should be inherited for one of the editor classes.... For more info on editor scripts search unify (unity wiki) also you can have a look at this page..

Thanks, but the question was more about, how to create a custom item, that behaves like an item in
“Assets->create”.

So that I click “Assets->create->New MyCostomItem”. Then a new item is added to the project tree, whit a unique name like “NewMyCostomItem”.
Similar to “Assets->create->New C# Script”. Which adds a new c# Script with a unique name “NewBehviourScript” (or “NewBehaviourScript1”…)

Is there any way to do that?
Exactly I want to do that:

  • I have a custom BehaviourScript derived from MonoBehaviour, called “MyMonoBehaviour”.
  • People that want to use this new BehaviourScript, should be able to add it like a normal c# script by “Assets->create->New MyMonoScript”
  • this adds a new c# Script which is by default derived from “MyMonoBehaviour” and gets a unique name: “NewMyMonoScript” or “NewMyMonoScript1” or “NewMyMonoScript2”, …

Is there really now way to do that?

So what about a Workaround:
If I add a component, is there a way to generate a unique name when the component is added?
Is there an event that tells me that a component was added? I then could use that event to create a unique name by myself?

Any help is appreciated :slight_smile: