Official 04. VaM2: Style Sheet Tutorial

Status
Not open for further replies.
1790088218196.png


VaM2: Style Sheets Guide

This guide assumes that you have basic knowledge of Unity and the VaM2 AddonKit.​


Quick Start​

Download the “VaMHuBStyleSheet” Unity package from here and import it into your VaM2AddonKit project.

Code:
Assets -> Import Package -> Custom Package

This will add a “VaMDeV” folder into your “UserArea” containing the “StyleSheetTemplate” subfolder. Inside is a scene file that is configured to export a single style sheet named “VaMHuBStyle” by “VaMDeV”. This can be used as a template for creating your own style sheet. If you want an example of exporting multiple style sheets as a single package, refer to the setup of “StyleSheetsAddonDark” within our “VaM2Shared/Addons/StyleSheets” folder in your VaM2AddonKit project.

Copy the folder “StyleSheetTemplate” into your own UserArea folder and rename the copied folder for your style sheet.

Open the “Scene” file inside the “StyleSheetTemplate” folder.

The pipeline is:
  • “StyleSheetVaMHuB” contains the style settings.
  • “StyleSheetsAddon” connects the style sheet to the VaM2 UI and contains addon metadata.
  • “AddonCreator” packages the addon for export into VaM2.
Select “StyleSheetVaMHuB”. This is where you will make all of your style changes.
In the Enhanced Style Sheet component, change the first entry, Uid, to the name of your style sheet. Below Uid, in the section marked “Styles”, each of the listed style inputs corresponds to an element of our “Universal Edit” UI Mode. Changing colors or sprites there will be reflected in the “StyleTest” node in the scene. When you finish making changes, apply them to the Unity prefab.

Select “StyleSheetsAddon”. Under the “Style Sheets Addon (Script)” change the “Display Name” to be the name of your Style Sheet Addon. Apply your changes to the Unity prefab.

Select “AddonCreator” in your scene. Change the “Creator Name” to your name and change the “Addon Name” to the name of your style sheet. Click “Build Addon” and then click “Deploy Addon”.

Congratulations, your new style sheet will now be available in your local VaM2 installation.

Those are the basic steps. Continue to the following sections for detailed information.


Scene Overview​

Open the “VaMHuBStyleSheet” scene file and view the Hierarchy tab.


AddonCreator​

1790086168876.png

Creates your addon and exports it into your local VaM2 game.
This is where you add your Creator Name, Addon Name, Addon Version, and select your License Type. You can also create multiple asset groups and add a thumbnail for your addon.​


StyleTest​

1790086978989.png

[/B]Do not edit this node.[/B] It is strictly for viewing your style sheet. To preview your style sheet, assign StyleTest to the “For Node” slot in the Enhanced Style Sheet (Script) of your StyleSheet.​


StyleSheetVaMHuB​

1790087005728.png

This is where you will be styling the UI. This is the node you will want to use as your template.​


StyleSheetsAddonVaMHuB​

1790087012540.png

This node places your addon within the proper category and connects your style sheet to the VaM2 UI. Here is where you can change your style sheet’s Display Name.​



StyleSheetVaMHuB​

Note: UI Icons cannot be changed. Animated sprites are currently not supported.


Enhanced Style Sheet (Script)​

The “Enhanced Style Sheet (Script)” component is used to create style sheets for VaM2 modes. This guide will explain the different functions of this script using the example provided in the “VaMHuBStyleSheet” Unity package.​


Uid​

1790087025009.png

Uid identifies the style sheet. This value appears in the Style Selection menu.
1790087030381.png


Is Exclusive​

1790087038578.png

This toggle is enabled by default. When enabled, the style sheet is used exclusively on the targeted UI mode and cannot be combined with other style sheets.​


Required Style Sheet​

1790087046315.png

If this style sheet depends on another style sheet, assign the required style sheet here.​


Style Sheet Group​

1790087053085.png

Multiple Style Sheets can be defined as a group. They can be loaded all at once or exclusively depending on how their individual “Is Exclusive” toggles are set.​



Group Setup​

Creating a Style Sheet Group is outside the scope of this tutorial. To create one in Unity:​
  • Create a new empty GameObject.
  • Add the StyleSheetGroup component to it.
  • Optionally, set the uid field in the Inspector to give it a custom identifier.
  • Assign this GameObject to the “Style Sheet Group” field of the style sheet's “Enhanced Style Sheet (Script)” component.
Example Hierarchy:​
Code:
StyleGroups (Parent)
├── DarkTheme (GameObject with StyleSheetGroup component, uid="DarkTheme")
├── LightTheme (GameObject with StyleSheetGroup component, uid="LightTheme")
└── HighContrast (GameObject with StyleSheetGroup component, uid="HighContrast")



Sort Order​

1790087065998.png

When multiple Style Sheets affect the same UI elements, Sort Order determines the order in which overlapping style settings are applied. Higher values override lower values.​


For Node​

1790087071683.png

Assign the StyleTest node to For Node to preview this style sheet in the scene instead of the default style.

1790087122804.png

When a StyleTest node is assigned, the Style Node Tree loads and its elements can be selected individually.

1790087155682.png

The Style Node Tree works with the Styles section, which is explained below.​


Copy From​

1790087170417.png

Assign a Style Sheet node that you wish to duplicate to “Copy From”. Click the “Copy” button to copy that sheet's settings into this one. This is an easy way to create a new Style Sheet for the default VaM2 UI.​


Styles​

​

Allow Add Without Node Selection
1790087180474.png


Enable this option to add style entries without first selecting a node from StyleTest.
1790087197186.png


When you select a node from the Style Node Tree, the corresponding style entry is highlighted.
1790087206861.png

1790087212257.png


When you add the highlighted style, it is automatically configured and linked to the selected node.
1790087221163.png




Style Types​

There are four style types. Each style type has the following common settings:​
  • Enabled: Determines whether this style entry is active.
  • Target Node Path: Set to UI.
  • Style Primitive Type: Specifies one of the following UI primitives: “Image”, “Text”, “Selectable”, or “InputField”.
  • Style Type: Specifies the particular VaM2 UI element that the style targets, such as “Interactable Modified”, “Panel Large”, or “Scrollbar Handle”.


ImageStyle: UI​

1790087232817.png


Sprite​

1790087240836.png

Enable this option to assign a sprite to the UI element. Currently animated sprites are not supported.​


Color​

1790087245822.png

Sets the base color. Leave this value white if you do not want to tint the sprite.​


Material​

1790087250641.png

Assigns the selected material to the UI component. This will override the color of a sprite.​


Fill Center​

1790087259661.png

Fill Center controls whether the center of a sliced image is rendered. When enabled, the center is rendered. When disabled, only the borders are rendered.​


Pixels Per Unit Multiplier​

1790087265470.png

Enable this option to adjust the pixel density used when rendering sliced sprites. The default value is 1. Change this value to adjust the appearance of the sprite's sliced regions without changing the dimensions of the UI element.​


Padding​

1790087270817.png

Enable Padding to add padding around the assigned sprite. Padding applies to all sides. Additional padding can be set independently for the top, bottom, left, and right sides.​


TextStyle: UI​

1790087276328.png

This is where you can assign specific fonts to your style sheet and change how they are displayed.​


SelectableStyle: UI​

1790087281454.png

Here you can select how the selectable elements of your UI give visual feedback.
You can use either the Color Tint or Sprite Swap transition. Selectable elements include all buttons (interactables) and slider handles.​


Transition​

1790087292137.png

Enables visual transitions for selectable UI elements. Currently, only “Color Tint” and “Sprite Swap” are functional.
Select “Color Tint” to use the “Color Tint Settings”. Select “Sprite Swap” to use the “Sprite Swap Settings”.​


Color Tint Settings​

1790087296315.png

Each color setting can be enabled individually. When enabled, the selected color is multiplied by the base image color.
]From top to bottom, the options are:​
  • “Normal Color”
  • “Highlighted Color”
  • “Pressed Color”
  • “Selected Color”
  • “Disabled Color”


Color Multiplier​

1790087301754.png

Enabling this allows you to adjust how much the “Color Tint Settings” affect the base image color.​


Sprite Swap Settings​

1790087305213.png

Enable a sprite swap setting to use the referenced sprite for that state.
From top to bottom, the options are:​
  • “Highlighted Sprite”
  • “Pressed Sprite”
  • “Selected Sprite”
  • “Disabled Sprite”
Replacement sprites should match the dimensions of the original sprite.​


InputFieldStyle: UI​


Selection Color​

1790087309203.png

Sets the highlight color displayed behind selected text.​


StyleSheetsAddon​

This node places your addon within the proper category and connects your style sheet to the VaM2 UI. Here is where you can change your style sheet’s Display Name.
The following sections explain the functions of the attached scripts.


Addon Game Object Controllables Set Container (Script)​

This script manages controllable parameters for dynamically created addon game objects in the VaM2 addon system. It cannot be edited.​


Attachments Controllables Set (Script)​

This script manages addon objects within VaM2. It handles the creation, attachment, and detachment of addon objects in real-time. This does not need to be edited.​


Style Sheets Addon (Script)​

This script manages style sheets for addon objects. This script allows you to set the name of your style sheet, a description and tags.
1790087322713.png

Display Name​

1790087329100.png

Enter the name of your style sheet as you want it to be presented within VaM2. This name can be different from what was entered in the Uid of your style sheet.​


Description​

1790087332422.png

Enter a description of your style sheet. In Beta 1.2, this information is not displayed in-game. However, it is included in the exported metadata for future support.​


Tags​

1790087335835.png

Add tags for your style sheet. Click the + or - button to add or remove entries. In Beta 1.2, this information is not displayed in-game. However, it is included in the exported metadata for future support.​


Style Sheets​

1790087339326.png

Assign your style sheet prefab to the field labeled “Element 0”. This links your style sheet with the StyleSheetsAddon node, enabling the AddonCreator to build and deploy your style sheet into the game.​



AddonCreator​

This node contains the settings used to build and deploy your addon. The following sections explain the functions of the attached scripts.


Addon Creator (Script)​

1790087344210.png


Auto Configure From Objects​

1790087350031.png

Assign your prefab to “Element 0” then click “Configure”. This will populate “Addon Asset Groups” with the information you entered into your StyleSheetsAddon node.​


Folder​

1790087357322.png

This is the name of your style sheet’s Unity folder. It will auto-populate when you click the “Configure” button.​


Creator Name​

1790087361694.png

Enter your name here. Your addon will be listed under your creator name. This field is not configured automatically and must be entered manually.​
Important: If this field is empty, it appears red and the addon cannot be built.


Addon Name​

1790087366514.png

This is the final display name of your addon.​

Addon Version​

1790087373210.png

This is where you can set the version number of your addon. By default, it is set to “1.0”.​


License Type​

1790087379225.png

This is where you set your license type. At the time of publication, VaM Hub accepts only CC-BY assets for distribution.
For more information about licensing, see our License Help page.​


Thumbnail Texture​

1790087400656.png

This is the thumbnail for your addon package and not for the addon itself. While not displayed in game, it is exported into your deployed addon folder and can be seen there.​


Customize Assets​

1790087405201.png

Enables editing of the Addon Asset Groups. Be aware that any changes made here are included in the built and deployed addon. They will not be updated in your StyleSheetsAddon node.


Addon Asset Groups​

1790087409403.png

This list is created after pressing the “Configure” button in the Auto Configure From Objects field. It is populated from the information within the StyleSheetsAddon node.
By default, only the thumbnail option can be changed. To edit these fields, enable “Customize Assets”.​
Important: Pressing “Configure” again will overwrite manual changes made here.


Asset​

1790087414153.png

This field is populated with your StyleSheetsAddon prefab.​


Thumbnail​

1790087426019.png

This is where you add the thumbnail for your addon. The thumbnail is displayed in-game.
If the thumbnail file has the same name as the StyleSheetsAddon, the Thumbnail field is populated automatically when you click Configure.​


Display Name​

1790087771949.png

This is the final name of your addon as it will be displayed in game.​


Description​

1790087822196.png

This is the final description stored in the addon's metadata file.​


Tags​

1790087827048.png

These are the final tags stored in the addon's metadata file.​


tenor.gif
 
Last edited:
Status
Not open for further replies.
Back
Top Bottom