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); }
public static void AddText(MenuCommand menuCommand) { MenuOptions.PlaceUIElementRoot(DefaultControls.CreateText(MenuOptions.GetStandardResources()), menuCommand); }
private static void CreateEventSystem(bool select) { MenuOptions.CreateEventSystem(select, (GameObject)null); }
public static void CreateEventSystem(MenuCommand menuCommand) { MenuOptions.CreateEventSystem(true, menuCommand.context as GameObject); }
static public void AddLImageForTP(MenuCommand menuCommand) { GameObject go = DefaultControls.CreateLImageForTP(); MenuOptions.PlaceUIElementRoot(go, menuCommand); }
public static void AddScrollView(MenuCommand menuCommand) { GameObject element = DefaultControls.CreateScrollView(MenuOptions.GetStandardResources()); MenuOptions.PlaceUIElementRoot(element, menuCommand); }