|
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.
(comments are locked)
|
|
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.. Yes, you can do the following to add to your picture (javascript): If you place that script in a folder named Editor, you will see the menu item once the script compiles. You can do anything you want with editor scripts: You can add components, initialize variables, assign assets to scripts, etc...
Jan 17 '12 at 05:49 AM
jahroy
(comments are locked)
|
|
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:
(comments are locked)
|
|
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 :) creating unique component (of script) means you are creating a new script file and adding it to the GameObject.. it is possible but y would someone have to do it??!!
Jan 17 '12 at 05:13 AM
flamy
It's hard to tell. I need it because there are other scripts which should work with the provided script. And for some reason it needs to be unique. So, if there's a way to do that, can you give me an example or a link or some more explanation?? Thanks
Jan 17 '12 at 09:44 AM
dago23
(comments are locked)
|
