[GUIDE] Managing large amount of backgrounds and other resources

General development topics: using various Unity tools, publishing games, etc.
Post Reply
Elringus
admin
Posts: 521
Joined: 11 May 2020 18:03

[GUIDE] Managing large amount of backgrounds and other resources

Post by Elringus »

Having a lot of background sprites / audio clips / character appearances / prefabs to spawn in your project and using resources editor becoming inconvenient? Want to group and organize the assets? Here is the solution!

Instead of exposing the resources via editor menus you can just keep them in a special folder or register with Unity's addressable system and they'll become automatically exposed for Naninovel.

For example, you can drop background appearance textures at Resources/Naninovel/Backgrounds folder, grouped under folders corresponding to actor ID. Eg, to add appearances for a background actor with "MainBackground" ID, store the textures (sprites) at Resources/Naninovel/Backgrounds/MainBackground folder and they'll automatically become available for reference in the naninovel scripts.

You can additionally organize resources with sub-folders, if you wish; in this case use forward slashes (/) when referencing them in naninovel scripts. Eg, appearance texture stored as Resources/Naninovel/Backgrounds/MainBackground/Events/CG251 can be referenced in scripts as

Code: Select all

@back Events/CG251

The Resources folder itself can be placed anywhere inside your project's Assets directory and there can be any number of them in a project. They're special folders, so Unity will be able to find them no matter where they're stored. Be aware, that anything you store inside those folders is automatically included to the build, so be careful and don't put anything there, unless it's actually used in the final game.

To use addressable asset system instead of "Resources" folders, assign address equal to the path you'd use to expose it via the method described above, except omit the "Resources/" part. Eg, to expose a "Beach" appearance for "MainBackground" background, assign the texture asset following address: Naninovel/Backgrounds/MainBackground/Beach. Be aware, that addressable provider is not used in editor by default; you can allow it by enabling Enable Addressable In Editor property in resource provider configuration menu.

You can find examples on how to expose each type of resource in the guide:

It's also possible to assign labels to the assets and use them when using editor search. See the following guide for more info: https://docs.unity3d.com/Manual/Searching.html

Post Reply