private void OnEnable() { if (EditorApplication.isCompiling) { return; } var scrollView = new iScrollView(); scrollView.autoSizeMode = iScrollViewAutoSize.HORIZONTAL; scrollView.direction = iScrollViewDirection.VERTICAL; scrollView.size = new Vector2(200, 200); scrollView.padding = new iPadding(4, 4, 24, 4, 4); for (int i = 0; i < 20; ++i) { var btn = new iButton(); btn.text = "Index : " + i; btn.size = new Vector2(25, 25); scrollView.AddChild(btn); } var checkBox = new iCheckBox(); checkBox.text = "Hello World"; checkBox.RelativePosition(iRelativePosition.BOTTOM_OF, scrollView); checkBox.size = new Vector2(100, EditorGUIUtility.singleLineHeight); checkBox.OnChanged = (sender) => { iCheckBox cb = (iCheckBox)sender; Debug.Log("CheckBox: " + cb.isChecked); }; var dd = new iDropDown(); dd.AddOption("Value 1", 1); dd.AddOption("Value 2", 2); dd.AddOption("Value 3", 3); dd.AddOption("Value 4", 3); dd.RelativePosition(iRelativePosition.BOTTOM_OF, checkBox); dd.OnChanged = (sender) => { iDropDown d = (iDropDown)sender; Debug.Log("Dropdown: " + d.selectedItem + ":" + d.selectedObject); }; AddChild(scrollView); AddChild(checkBox); AddChild(dd); }
private void Init() { button = new iButton(); button.OnClicked = (sender) => { foreach (var obj in Selection.gameObjects) { var icon = obj.GetComponent <HierarchyIconBoost>(); if (path != "None") { if (icon == null) { icon = obj.AddComponent <HierarchyIconBoost>(); icon.hideFlags = HideFlags.HideInInspector; } icon.content = EditorGUIUtility.IconContent(path); } else { if (icon != null) { GameObject.DestroyImmediate(icon); } } } EditorApplication.RepaintHierarchyWindow(); }; icon = new iBox(); icon.size = new Vector2(16, 16); icon.style = new GUIStyle(); if (path != "None") { icon.LoadBuiltInIcon(path); } label = new iLabel(); }
private void Init() { button = new iButton(); button.OnClicked = (sender) => { if (EditorSceneManager.SaveModifiedScenesIfUserWantsTo(new Scene[] { SceneManager.GetActiveScene() })) { EditorSceneManager.OpenScene(path); if (iSceneNavigation.window != null) { iSceneNavigation.window.Close(); } } }; icon = new iBox(); icon.size = new Vector2(16, 16); icon.style = new GUIStyle(); icon.LoadBuiltInIcon("SceneAsset Icon"); label = new iLabel(); }