The 'Core UI' mod includes UI Entities which can be used to be build UI such as the player's HUD, menu screens, and other ingame displays.
UI Entities have to be in a UI Canvas entity.
The 'UI Canvas' can be set to 'Screen Overlay' mode - which will then show it on the Screen for all users (but not in VR player headsets). To create a HUD / UIScreen - a Prefab needs to be created of the canvas
- One important aspect of creating UI is setting the Alignment. By default UI entities align to the center - but when creating a HUD you might want to align to the bottom / top / right / left. This is important since the Canvas will be displayed at different sizes depending on the players resolution.
To create a HUD / UI Screen for users, create a Prefabs of the UI Canvas.
To set this prefab as the default HUD for all players - set 'Default HUD' in 'Players' section of Creation Settings. This will then add that HUD to the player when they start playing.
To add a HUD to a specific player - add a EntPlayerHUD component to the User/Avatar and set the prefab as 'UseCanvases' list
The Wiring system and MBScript can be used to control the UI and what it displays.
- To create a UI Screen - in the 'Assets' screen create a new 'UI Screen Entity Canvas' asset. Then set it's 'Canvas Prefab' to the UI Prefab
- A UI Screen can be set to be 'Show In Menu Options' - so it will shown as a option when the user has their menu open
- UI Screens can be shown to a User through MBScript by using 'User.ShowScreen('
- In Creation Settings - a UI Screen can be set as the 'Game Menu'. It will then show as a option to open while playing (as a input hint on the screen to open for screen players with Tab, or as a button on a VR controller)
Updated almost 2 years ago