Sharing UI packs
Below is the guide on how to create and share customized Naninovel UIs (title menu, settings, text printers, etc). Can be useful in case you'd like to share UI packs between projects or sell them to other users.
Make sure to use minimum supported Unity version (2019.4.24
at the time of writing) for better compatibility.
Create a new folder to store the assets for the shared content.
Inside the folder, create the prefabs for the UIs you wish to override using Create -> Naninovel -> Default UI -> ...
menu (or similar menus for text printer and choice handlers).
Customize the UIs. You can change anything inside the prefabs, including the C# components. If you wish, you can remove everything and create the entire prefab from scratch. The only requirement is that the prefab should have a component compatible with a specific interface attached to the root game object. For example, title UI is expected to have a component, which implements ITitleUI
interface. When adding a custom UI (not overriding a built-in one), the only requirement is for the component to implement IManagedUI
interface.
Store all the assets used in the prefabs (textures, audio clips, C# scripts, other prefabs, etc) in the same folder; organize them in sub-folders as you see fit.
When everything is ready, export the package by right-clicking on the folder and choosing Export Package...
Important
Make sure to disable Include dependencies
option when exporting to prevent Naninovel sources from being included.
Click "Export" button and save the .unitypackage file.
You can now share and import the package file to other projects by drag-dropping it to the "Assets" folder in the project view. To use the customized UIs after importing the package, open UI resources list via Naninovel -> Resources -> UI
editor menu and drag-drop the custom UI prefabs, replacing built-in ones (or adding new ones).
If you'd like to update your pack, just repeat the export procedure; when user will attempt to import an updated package, it'll automatically resolve which files have changed and overwrite them.