public static void AddGridMap() { GameObject tGameObject = Selection.activeGameObject; if (tGameObject == null) { return; } if (WillLosePrefab(tGameObject) == false) { return; } Undo.RecordObject(tGameObject, "Add a child UI GridMap"); // アンドウバッファに登録 GameObject tChild = new GameObject(GetName <UIGridMap>(), typeof(RectTransform)); Transform tTransform = tChild.transform; tTransform.SetParent(tGameObject.transform, false); tTransform.localPosition = Vector3.zero; tTransform.localRotation = Quaternion.identity; tTransform.localScale = Vector3.one; UIGridMap tGridMap = tChild.AddComponent <UIGridMap>(); tGridMap.SetDefault(); Selection.activeGameObject = tChild; UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene()); }
/// <summary> /// スンスペクター描画 /// </summary> override protected void DrawInspectorGUI() { // ターゲットのインスタンス UIGridMap tTarget = target as UIGridMap; EditorGUILayout.Separator(); // 少し区切りスペース //------------------------------------------------------------------- // マテリアル選択 DrawMaterial(tTarget); //------------------------------------------------------------------- }