UI Editing

  • 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

11841184

A UI Canvas is placed in the world then the UI entities are added to it. Here a NumberBar is added to be used to display health.

Alignment

  • 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.
631631

Can set the alignment in the 'UI Transform' component

UI Prefabs

  • 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.

UI Screens

  • 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)