how to use Nani command in C# script

Using Naninovel C# APIs: adding custom actor implementations or commands, overriding engine services, integrating with other systems, etc.
Post Reply
TuTlo
Posts: 14
Joined: 02 Jun 2022 14:40

how to use Nani command in C# script

Post by TuTlo »

Hi,

I would like to use @showUI myUI in a C# script, is there any reference on how to use Nani command in C# script? could not find it

Thanks!

Elringus
admin
Posts: 538
Joined: 11 May 2020 18:03

Re: how to use Nani command in C# script

Post by Elringus »

There is nothing special here: create instance of the command and invoke ExecuteAsync method on it.

It's mentioned in the integration guide: https://naninovel.com/guide/integration ... hing-modes

Here are the sources: https://github.com/Naninovel/Integratio ... cs#L14-L15

Elringus
admin
Posts: 538
Joined: 11 May 2020 18:03

Re: how to use Nani command in C# script

Post by Elringus »

That said, I'd recommend against using commands like this; instead access Naninovel APIs directly. Eg, instead of creating an instance of show UI command and invoking execute method on it, inspect the command implementation and invoke the required APIs directly. For example, to show a UI get IUIManager service, use GetUI method to get reference to the desired UI and invoke Show method on it. Here is the guide on engine services: https://naninovel.com/guide/engine-services

Post Reply