26 lines
981 B
C#
26 lines
981 B
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace AlicizaX.UI.Extension.Editor
|
|
{
|
|
internal static class MenuExtension
|
|
{
|
|
[MenuItem("GameObject/UI/UXTextMeshPro", false, -1)]
|
|
static void CreateUXTextMeshProUX()
|
|
{
|
|
GameObject selectionObject = Selection.activeGameObject;
|
|
var gameObject = new GameObject("UXTextMeshPro", typeof(UXTextMeshPro));
|
|
gameObject.transform.SetParent(selectionObject.transform);
|
|
var rectTransform = gameObject.GetComponent<RectTransform>();
|
|
var uxTextMeshPro = gameObject.GetComponent<UXTextMeshPro>();
|
|
uxTextMeshPro.text="UXTextMeshPro";
|
|
rectTransform.anchoredPosition = Vector2.zero;
|
|
rectTransform.localPosition = Vector3.zero;
|
|
rectTransform.pivot = new Vector2(0.5f, 0.5f);
|
|
rectTransform.localScale = Vector3.one;
|
|
Selection.activeGameObject = gameObject;
|
|
}
|
|
}
|
|
}
|