Whether from a menu item, or an Inspector view, there are times when we want to create a new GameObject in the scene from an Editor Extension. In this recipe, we'll create a new GameObject and set its position and color randomly:

Whether from a menu item, or an Inspector view, there are times when we want to create a new GameObject in the scene from an Editor Extension. In this recipe, we'll create a new GameObject and set its position and color randomly:
To create an object and change its value follow these steps:
using UnityEditor;
using UnityEngine;
public class ObjectManager : EditorWindow
{
[MenuItem("GameObject/MyObjectManager/Create New Empty Game Object")]
static void CreateCustomEmptyGameObject...