During the game, I want the player to call up a menu at any time by right-clicking on the screen,and to pause the text printer.
Also, I realize that a pauseUI has been created in the plugin. How do I get the player to call it in the game
thanks
During the game, I want the player to call up a menu at any time by right-clicking on the screen,and to pause the text printer.
Also, I realize that a pauseUI has been created in the plugin. How do I get the player to call it in the game
thanks
You can add your own custom input binding through a simple bit of C# scripting. You can use the listener scripts showcased in the Inventory Example project (https://github.com/Naninovel/Inventory/ ... UI.cs#L215) as the basis for this.
I also recommend checking out Engine Services, specifically IUIManager which contains publicly available methods for calling UI's in C#. https://naninovel.com/guide/engine-serv ... e-services
idaot wrote: ↑07 Jul 2021 18:43You can add your own custom input binding through a simple bit of C# scripting. You can use the listener scripts showcased in the Inventory Example project (https://github.com/Naninovel/Inventory/ ... UI.cs#L215) as the basis for this and when done correctly, the new binding will show up under Naninovel's input configuration which you can bind to several inputs.
I also recommend checking out Engine Services, specifically IUIManager which contains publicly available methods for calling UI's in C#. https://naninovel.com/guide/engine-serv ... e-services
Oh!I've learned :D
idaot wrote: ↑07 Jul 2021 18:43You can add your own custom input binding through a simple bit of C# scripting. You can use the listener scripts showcased in the Inventory Example project (https://github.com/Naninovel/Inventory/ ... UI.cs#L215) as the basis for this and when done correctly, the new binding will show up under Naninovel's input configuration which you can bind to several inputs.
I also recommend checking out Engine Services, specifically IUIManager which contains publicly available methods for calling UI's in C#. https://naninovel.com/guide/engine-serv ... e-services
Is there no easier option to implement this? This is such a basic and elementary functionality for the convenience of players, which is needed in almost any novel. It's sad if you have to bother so much technically for such a simple function.: (
fyrrion wrote: ↑12 Jul 2021 15:29idaot wrote: ↑07 Jul 2021 18:43You can add your own custom input binding through a simple bit of C# scripting. You can use the listener scripts showcased in the Inventory Example project (https://github.com/Naninovel/Inventory/ ... UI.cs#L215) as the basis for this and when done correctly, the new binding will show up under Naninovel's input configuration which you can bind to several inputs.
I also recommend checking out Engine Services, specifically IUIManager which contains publicly available methods for calling UI's in C#. https://naninovel.com/guide/engine-serv ... e-services
Is there no easier option to implement this? This is such a basic and elementary functionality for the convenience of players, which is needed in almost any novel. It's sad if you have to bother so much technically for such a simple function.: (
As far as C# is concerned, this is very simple. I highly recommend learning a bit of C# as the engine services provided with Naninovel will open up a lot of possibilities.
Here's a code that can be attached to a custom UI. Make sure to create a sampler within Input Configuration that corresponds with the string given in GetSampler.
Code: Select all
using UnityEngine;
using Naninovel;
using Naninovel.UI;
public class CallUIInput : CustomUI
{
private IInputManager inputManager;
protected override void Awake()
{
base.Awake(); // make sure the required objects are assigned in the inspector
inputManager = Engine.GetService<IInputManager>();
}
protected override void OnEnable()
{
base.OnEnable();
// Start listening for `ToggleInventory` input event to toggle UI's visibility.
var toggleSampler = inputManager.GetSampler("ToggleSamplerUI");
if (toggleSampler != null)
toggleSampler.OnStart += ToggleVisibility;
}
protected override void OnDisable()
{
base.OnDisable();
// Stop listening for `ToggleInventory` input event.
var toggleSampler = inputManager?.GetSampler("ToggleSamplerUI");
if (toggleSampler != null)
toggleSampler.OnStart -= ToggleVisibility;
}
}