using UnityEngine;
|
using UnityEditor;
|
using UnityEngine.UI;
|
static internal class MenuOptionsEx {
|
[MenuItem("GameObject/UI/NumKeyBoard")]
|
public static void AddNumKeyBoard()
|
{
|
if (Selection.gameObjects == null || Selection.gameObjects.Length == 0) return;
|
GameObject go = UILoader.LoadPrefab("NumKeyboard");
|
go=GameObject.Instantiate(go);
|
go.name = "NumKeyboard";
|
Text text = Selection.gameObjects[0].GetComponent<Text>();
|
NumKeyBoard keyboard=go.GetComponent<NumKeyBoard>();
|
if (keyboard != null) keyboard.targetText = text;
|
go.transform.SetParent(Selection.gameObjects[0].transform);
|
go.transform.localPosition = Vector3.zero;
|
go.transform.localScale = Vector3.one;
|
}
|
}
|