A game about forced loneliness, made by TACStudios
at master 35 lines 1.1 kB view raw
1using System; 2using UnityEditor.U2D.Animation; 3using UnityEngine; 4using UnityEngine.UIElements; 5 6namespace UnityEditor.U2D.Layout 7{ 8 internal static class LayoutOverlayUtility 9 { 10 public static Button CreateButton(string name, Action clickEvent, string tooltip = null, string text = null, string imageResourcePath = null, string stylesheetPath = null) 11 { 12 Button button = new Button(clickEvent); 13 button.name = name; 14 button.tooltip = tooltip; 15 16 if (!String.IsNullOrEmpty(text)) 17 button.text = text; 18 if (!String.IsNullOrEmpty(imageResourcePath)) 19 { 20 var texture = ResourceLoader.Load<Texture>(imageResourcePath); 21 if (texture != null) 22 { 23 Image image = new Image(); 24 image.image = texture; 25 button.Add(image); 26 } 27 } 28 if (!String.IsNullOrEmpty(stylesheetPath)) 29 button.styleSheets.Add(ResourceLoader.Load<StyleSheet>(stylesheetPath)); 30 31 return button; 32 } 33 } 34 35}