The engine is designed with the following principles in mind: scene independence and service-orientation.
While Unity design promotes using scenes and prefabs composition, it's not very practical when developing visual novels.
The following root objects are used, depending on the environment:
Naninovel<Runtime>for runtime (builds and editor play mode);
Naninovel<Editor>for editor (outside of play mode).
All the required gameobjects are created on engine initialization, which is executed automatically and asynchronously when the application starts (right after entering play mode or running a build) via a RuntimeInitializeOnLoadMethod method. You can change this behavior by disabling
Initialize On Application Load property in the engine configuration and manually invoking the initialization using
Naninovel.RuntimeInitializer (for runtime) or
Naninovel.EditorInitializer (for editor) classes.
As the initialization process is asynchronous, either use async-await approach when invoking the
InitializeAsync() method or subscribe to the static
To completely disable and remove from memory all the engine systems, use
Naninovel.Engine.Destroy() static method.
Most of the engine features are implemented via engine services. Engine service is an implementation of an
IEngineService interface, which handles a specific job, like executing novel scripts, managing actors or saving-loading the game state.
In case you wish to interact with an engine system, you'll most likely want to use an engine service. You can get a reference to an engine service using
Naninovel.Engine.GetService<TService>() static method, where
TService is the type of service you wish to reference; e.g., to get a
var player = Naninovel.Engine.GetService<NovelScriptPlayer>(); player.Stop();
You can find the list of all the currently available engine services in the "Engine Services" guide.
The following UML diagram illustrates a high-level concept of the engine architecture. Note that all the class and interface names in the diagram are organized under
Naninovel namespace. Eg, to reference an
Engine class, use