- Home /
Extending "GameObject/Create Other" with own prefab
The topic says it all.. Is it possible to create a C# script which adds a custom Prefab to the Editor menu? How would I do this?
Thanks 4 your thoughts! :)
Comment
Best Answer
Answer by yoyo · Jun 08, 2011 at 09:56 PM
You can add the custom menu item like this ...
public static class WombatCreator
{
[MenuItem("GameObject/Create Other/Wombat")]
static void CreateWombat()
{
Debug.Log("wombat");
}
}
To instantiate a prefab, you could use AssetDatabase.LoadAssetAtPath to find the prefab, then EditorUtility.InstantiatePrefab to create a copy of it in the scene.
Your answer
Follow this Question
Related Questions
Saving its values through custom Editor 2 Answers
Custom Data structs & Inspector 1 Answer
Apply only a single value to prefab 1 Answer
PrefabUtility.GetPrefabObject doesn't work! 2 Answers
Breaking a prefab connection 7 Answers