/// <summary> /// Helper function for menu creation. /// </summary> static void AddPanel(object obj) { GameObject go = obj as GameObject; if (go.GetComponent <UIWidget>() != null) { go = go.transform.parent.gameObject; } UIPanel panel = NGUISettings.AddPanel(go); Selection.activeGameObject = panel.gameObject; }
static void AddScrollView() { UIPanel panel = NGUISettings.AddPanel(SelectedRoot()); if (panel == null) { panel = NGUIEditorTools.SelectedRoot(true).GetComponent <UIPanel>(); } panel.clipping = UIDrawCall.Clipping.SoftClip; panel.name = "Scroll View"; Selection.activeGameObject = panel.gameObject; }
/// <summary> /// Helper function for menu creation. /// </summary> static void AddScrollView(object obj) { GameObject go = obj as GameObject; if (go.GetComponent <UIWidget>() != null) { go = go.transform.parent.gameObject; } UIPanel panel = NGUISettings.AddPanel(go); panel.clipping = UIDrawCall.Clipping.SoftClip; panel.gameObject.AddComponent <UIScrollView>(); panel.name = "Scroll View"; Selection.activeGameObject = panel.gameObject; }
static void AddCustomScrollView() { GameObject go = NGUIEditorTools.SelectedRoot(true); GameObject svParent = new GameObject("Scroll View Parent"); svParent.transform.SetParent(go.transform); UIPanel panel = NGUISettings.AddPanel(SelectedRoot()); if (panel == null) { panel = NGUIEditorTools.SelectedRoot(true).GetComponent <UIPanel>(); } panel.clipping = UIDrawCall.Clipping.SoftClip; panel.name = "Scroll View"; panel.gameObject.AddComponent <UIScrollView>(); Selection.activeGameObject = panel.gameObject; //panel.gameObject.AddComponent<Air2000.ScrollViewScale>(); panel.transform.SetParent(svParent.transform); }
static void AddPanel() { UIPanel panel = NGUISettings.AddPanel(SelectedRoot()); Selection.activeGameObject = (panel == null) ? NGUIEditorTools.SelectedRoot(true) : panel.gameObject; }