Add this scoped registry.
"scopedRegistries": [
{
"name": "Mr. Watts UPM Registry",
"url": "https://gitlab.com/api/v4/projects/27157125/packages/npm/",
"scopes": [
"io.mrwatts"
]
}
]Add the following dependency in the manifest.json file in the "Packages" folder.
"io.mrwatts.messageboxes": "1.0.0"The version number should be the latest version of the package (unless you want to target an older version on purpose).
This package depends on
io.mrwatts.fuelinjectio.mrwatts.extensions
To setup any MessageBox, first create 2 prefabs:
- The first prefab ('messageBoxPrefab') will function as the MessageBox itself, it should contain a
MessageBoxcomponent. Make sure it has a textfield and a container for buttons. These need to be assigned to thelabelMessageandpanelButtonsfields respectively in theMessageBoxcomponent. - The second prefab is a button of the MessageBox and should have a
MessageBoxButtoncomponent. Make sure the button also has a textfield of his own, as well as aButtoncomponent. Both need to be assigned in theMessageBoxButtoncomponent. Assign the button prefab to thebuttonPrefabfield in theMessageBoxcomponent of the 'messageBoxPrefab'.
If you need one MessageBox to be instantiated at a time, add the following in any ContainerModule, where builder is of type ContainerBuilder:
builder.RegisterSingleMessageBoxFactory(messageBoxPrefab);If you want the MessageBox to be instantiated in a specific parent Transform parentContainer, you can add it as follows:
builder.RegisterSingleMessageBoxFactory(messageBoxPrefab, parentContainer);If you have multiple messageboxes, eg. one as a floating window in XR and another on a flat surface like a virtual desktop, add the following in any ContainerModule, where builder is of type ContainerBuilder:
List<(GameObject messageBoxPrefab, Transform? parentContainer)> messageBoxSettings = new()
{
(messageBoxPrefab1, parentContainer1),
(messageBoxPrefab2, parentContainer2),
};
builder.RegisterAggregatedMessageBoxFactory(messageBoxSettings);