修改
This commit is contained in:
parent
f71b5c3c7c
commit
5b670c2464
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using TMPro;
|
||||||
using TMPro.EditorUtilities;
|
using TMPro.EditorUtilities;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -59,6 +60,27 @@ internal class UXUIEditor : Editor
|
|||||||
obj.AddComponent<UXButton>();
|
obj.AddComponent<UXButton>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MenuItem("GameObject/UI/UXInput Field")]
|
||||||
|
public static void CreateUXInputField(MenuCommand menuCommand)
|
||||||
|
{
|
||||||
|
Type MenuOptionsType = typeof(TMPro.EditorUtilities.TMPro_CreateObjectMenu).Assembly.GetType("TMPro.EditorUtilities.TMPro_CreateObjectMenu");
|
||||||
|
InvokeMethod(MenuOptionsType, "AddTextMeshProInputField", new object[] { menuCommand });
|
||||||
|
GameObject obj = Selection.activeGameObject;
|
||||||
|
obj.name = "UXInputField";
|
||||||
|
TMP_InputField inputField = obj.GetComponent<TMP_InputField>();
|
||||||
|
TextMeshProUGUI oldTextField = inputField.placeholder.GetComponent<TextMeshProUGUI>();
|
||||||
|
GameObject placeholderGameObject = inputField.placeholder.gameObject;
|
||||||
|
float oldFontSize = oldTextField.fontSize;
|
||||||
|
Color oldColor = oldTextField.color;
|
||||||
|
string oldText = oldTextField.text;
|
||||||
|
DestroyImmediate(oldTextField);
|
||||||
|
TextMeshProUGUI newTextField = placeholderGameObject.AddComponent<TextMeshProUGUI>();
|
||||||
|
newTextField.fontSize = oldFontSize;
|
||||||
|
newTextField.color = oldColor;
|
||||||
|
newTextField.text = oldText;
|
||||||
|
inputField.placeholder = newTextField;
|
||||||
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/UXScrollView")]
|
[MenuItem("GameObject/UI/UXScrollView")]
|
||||||
private static void CreateUxRecyclerView()
|
private static void CreateUxRecyclerView()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user