This script adds the UI menu options to the Unity Editor.
コード例 #1
0
        public static GameObject GetOrCreateCanvasGameObject()
        {
            GameObject activeGameObject = Selection.activeGameObject;
            Canvas     canvas           = (!(activeGameObject != null)) ? null : activeGameObject.GetComponentInParent <Canvas>();
            GameObject result;

            if (canvas != null && canvas.gameObject.activeInHierarchy)
            {
                result = canvas.gameObject;
            }
            else
            {
                canvas = (UnityEngine.Object.FindObjectOfType(typeof(Canvas)) as Canvas);
                if (canvas != null && canvas.gameObject.activeInHierarchy)
                {
                    result = canvas.gameObject;
                }
                else
                {
                    result = MenuOptions.CreateNewUI();
                }
            }
            return(result);
        }
コード例 #2
0
 public static void AddText(MenuCommand menuCommand)
 {
     MenuOptions.PlaceUIElementRoot(DefaultControls.CreateText(MenuOptions.GetStandardResources()), menuCommand);
 }
コード例 #3
0
 private static void CreateEventSystem(bool select)
 {
     MenuOptions.CreateEventSystem(select, (GameObject)null);
 }
コード例 #4
0
 public static void CreateEventSystem(MenuCommand menuCommand)
 {
     MenuOptions.CreateEventSystem(true, menuCommand.context as GameObject);
 }
コード例 #5
0
        static public void AddLImageForTP(MenuCommand menuCommand)
        {
            GameObject go = DefaultControls.CreateLImageForTP();

            MenuOptions.PlaceUIElementRoot(go, menuCommand);
        }
コード例 #6
0
        public static void AddScrollView(MenuCommand menuCommand)
        {
            GameObject element = DefaultControls.CreateScrollView(MenuOptions.GetStandardResources());

            MenuOptions.PlaceUIElementRoot(element, menuCommand);
        }