
It's a bit complex to use this but if you need a scrollbar you should look into this.īasically it needs a separate object for decrement, increment, thumb and track and you have to specify a lot of values such as min/max value, orientation, stepSize. Interactive scrollbar which can be used for a scrollable panel or other scrollable content. I believe it automatically calls FitToContents() when you add contents to this panel if not you should call that after you add content. Panel which can be scrollable through mouse and keyboard events and you can attach a scrollbar.
autoLayoutDirection - This can be changed to horizontal or vertical if auto layout is enabled. autoFitChildrenVertically - Ensures that components fit vertically. autoFitChildrenHorizontally - Ensures that components fit horizontally. verticalSpacing - Vertical spacing between UI elements within the panel for dynamic layouts. autoLayout - Disable automatic layout to handle the layout manually. backgroundSprite - Sprite for the panel background. Panel is a container where you usually put other components in.īy default the elements in the panel are automatically positioned but this can be disabled.
(there are like 20 other events you can listen to)
eventClick - delegate (MouseEventHandler) when UI element is clicked on. opacity - Change the transparancy of the UI element. playAudioEvents - When set to true certain UI elements will play audio events when interacted with. tooltip - Tooltip text which will display when you hover over the UI element for a bit. color - Main color of the UI component, some components have their own color values such as UILabel has textColor.
isInteractive - Whether or not this UI element can be interacted with. This is the base class of all UI components. There are a ton of other components and properties not listed here so if you're making something first do a search if there is a component for it. UI Components API Reference īelow are most components described and their most useful properties. TIP: If you press CTRL+R and then hover over a component and then press CTRL+F it'll open that component in the inspector. You can use this to copy properties, see how components are structured, modify components at runtime to see what the properties do and much more. If you use ModTools (which you should) you can browse through the UIView to see all the components in the game. This is how you can then use the texture. Have a look at the source of TM:PE if you're interested.īasically you have to include them in your assembly and then load them out of your assembly during runtime by reading the bytes of the image and converting it in to a texture. You can subscribe to a mod that dumps all the sprites in the game to see what you can use.Ĭustom sprites are quite hard to do but it's possible. Sprites are referenced by name based on the selected sprite atlas. name = "MyModPanel" // Please give UI components you add to the view a name! UILabel title = panel. AddUIComponent ( typeof ( UIPanel )) as UIPanel panel.